sprinkle some newlines around

This commit is contained in:
Anders Ingemann 2013-07-07 17:06:44 +02:00
parent 4180f16656
commit eec41422fc
4 changed files with 13 additions and 7 deletions

View file

@ -30,7 +30,8 @@ class AptUpgrade(Task):
def run(self, info):
rc_policy_path = os.path.join(info.root, 'usr/sbin/policy-rc.d')
with open(rc_policy_path, 'w') as rc_policy:
rc_policy.write('#!/bin/sh\nexit 101')
rc_policy.write(('#!/bin/sh\n'
'exit 101'))
import stat
os.chmod(rc_policy_path,
stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR |

View file

@ -28,7 +28,8 @@ class ConfigureGrub(Task):
from common.tools import sed_i
grub_def = os.path.join(info.root, 'etc/default/grub')
sed_i(grub_def, '^GRUB_TIMEOUT=[0-9]+', 'GRUB_TIMEOUT=0\nGRUB_HIDDEN_TIMEOUT=true')
sed_i(grub_def, '^GRUB_TIMEOUT=[0-9]+', 'GRUB_TIMEOUT=0\n'
'GRUB_HIDDEN_TIMEOUT=true')
from common.tools import log_check_call
log_check_call(['chroot', info.root, 'update-grub'])
@ -42,7 +43,8 @@ class BlackListModules(Task):
def run(self, info):
blacklist_path = os.path.join(info.root, 'etc/modprobe.d/blacklist.conf')
with open(blacklist_path, 'a') as blacklist:
blacklist.write('# disable pc speaker\nblacklist pcspkr')
blacklist.write(('# disable pc speaker\n'
'blacklist pcspkr'))
class DisableGetTTYs(Task):

View file

@ -120,6 +120,6 @@ class ModifyFstab(Task):
mount_opts.append('nobarrier')
fstab_path = os.path.join(info.root, 'etc/fstab')
with open(fstab_path, 'a') as fstab:
fstab.write(('/dev/xvda1 / {filesystem} {mount_opts} 1 1'
fstab.write(('/dev/xvda1 / {filesystem} {mount_opts} 1 1\n'
.format(filesystem=info.manifest.volume['filesystem'].lower(),
mount_opts=','.join(mount_opts))))

View file

@ -18,9 +18,12 @@ class ConfigureNetworkIF(Task):
def run(self, info):
interfaces_path = os.path.join(info.root, 'etc/network/interfaces')
if_config = {'squeeze': ('auto lo\niface lo inet loopback\n'
'auto eth0\niface eth0 inet dhcp'),
'wheezy': 'auto eth0\niface eth0 inet dhcp'}
if_config = {'squeeze': ('auto lo\n'
'iface lo inet loopback\n'
'auto eth0\n'
'iface eth0 inet dhcp\n'),
'wheezy': 'auto eth0\n'
'iface eth0 inet dhcp\n'}
with open(interfaces_path, 'a') as interfaces:
interfaces.write(if_config.get(info.manifest.system['release']))