From 3bc47f69f77c31dd7d5236645f125111b9cd2fb4 Mon Sep 17 00:00:00 2001 From: Tomasz Rybak Date: Thu, 9 Jan 2014 21:25:22 +0100 Subject: [PATCH] Fix unstable package repository and network configuration. --- common/tasks/apt.py | 5 +++-- common/tasks/network-configuration.json | 13 +++++++++++++ common/tasks/network.py | 12 +++++------- providers/ec2/tasks/packages.py | 4 ++-- 4 files changed, 23 insertions(+), 11 deletions(-) create mode 100644 common/tasks/network-configuration.json diff --git a/common/tasks/apt.py b/common/tasks/apt.py index ca3c545..e925c5d 100644 --- a/common/tasks/apt.py +++ b/common/tasks/apt.py @@ -25,8 +25,9 @@ class AddDefaultSources(Task): def run(cls, info): info.source_lists.add('main', 'deb {apt_mirror} {system.release} main') info.source_lists.add('main', 'deb-src {apt_mirror} {system.release} main') - info.source_lists.add('main', 'deb {apt_mirror} {system.release}-updates main') - info.source_lists.add('main', 'deb-src {apt_mirror} {system.release}-updates main') + if info.manifest.system['release'] != 'unstable': + info.source_lists.add('main', 'deb {apt_mirror} {system.release}-updates main') + info.source_lists.add('main', 'deb-src {apt_mirror} {system.release}-updates main') class InstallTrustedKeys(Task): diff --git a/common/tasks/network-configuration.json b/common/tasks/network-configuration.json new file mode 100644 index 0000000..854ed22 --- /dev/null +++ b/common/tasks/network-configuration.json @@ -0,0 +1,13 @@ +{ + "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" ], + "unstable": [ + "auto eth0\n", + "iface eth0 inet dhcp\n" ] +} diff --git a/common/tasks/network.py b/common/tasks/network.py index ecd5eff..6be1de7 100644 --- a/common/tasks/network.py +++ b/common/tasks/network.py @@ -30,11 +30,9 @@ class ConfigureNetworkIF(Task): @classmethod def run(cls, info): interfaces_path = os.path.join(info.root, 'etc/network/interfaces') - 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'} + if_config = [] + with open('common/tasks/network-configuration.json') as stream: + import json + if_config = json.loads(stream.read()) with open(interfaces_path, 'a') as interfaces: - interfaces.write(if_config.get(info.manifest.system['release'])) + interfaces.write(''.join(if_config.get(info.manifest.system['release']))) diff --git a/providers/ec2/tasks/packages.py b/providers/ec2/tasks/packages.py index 895dc76..242457a 100644 --- a/providers/ec2/tasks/packages.py +++ b/providers/ec2/tasks/packages.py @@ -19,8 +19,8 @@ class DefaultPackages(Task): # In squeeze, we need a special kernel flavor for xen kernels = {} - with open('packages-kernels.json') as stream: + with open('providers/ec2/tasks/packages-kernels.json') as stream: import json - kernel = json.loads(stream.read()) + kernels = json.loads(stream.read()) kernel_package = kernels.get(info.manifest.system['release']).get(info.manifest.system['architecture']) info.packages.add(kernel_package)