diff --git a/providers/ec2/tasks/apt.py b/providers/ec2/tasks/apt.py index 1f5d8d3..3da13c5 100644 --- a/providers/ec2/tasks/apt.py +++ b/providers/ec2/tasks/apt.py @@ -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 | diff --git a/providers/ec2/tasks/boot.py b/providers/ec2/tasks/boot.py index a489268..29a610d 100644 --- a/providers/ec2/tasks/boot.py +++ b/providers/ec2/tasks/boot.py @@ -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): diff --git a/providers/ec2/tasks/filesystem.py b/providers/ec2/tasks/filesystem.py index c9f5284..9d07caa 100644 --- a/providers/ec2/tasks/filesystem.py +++ b/providers/ec2/tasks/filesystem.py @@ -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)))) diff --git a/providers/ec2/tasks/network.py b/providers/ec2/tasks/network.py index 4fdecb5..0910608 100644 --- a/providers/ec2/tasks/network.py +++ b/providers/ec2/tasks/network.py @@ -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']))