Translate release names into codenames. Fixes #15

This commit is contained in:
Anders Ingemann 2014-02-23 21:14:21 +01:00
parent 7a4721bd70
commit 739e22e929
6 changed files with 48 additions and 35 deletions

View file

@ -16,6 +16,10 @@ class BootstrapInformation(object):
self.apt_mirror = self.manifest.packages.get('mirror', 'http://http.debian.net/debian') self.apt_mirror = self.manifest.packages.get('mirror', 'http://http.debian.net/debian')
release_codenames_path = os.path.join(os.path.dirname(__file__), 'release-codenames.json')
from common.tools import config_get
self.release_codename = config_get(release_codenames_path, [self.manifest.system['release']])
class DictClass(dict): class DictClass(dict):
def __getattr__(self, name): def __getattr__(self, name):
return self[name] return self[name]

View file

@ -0,0 +1,22 @@
{ // This is a mapping of Debian release names to their respective codenames
"unstable": "sid",
"testing": "jessie",
"stable": "wheezy",
"oldstable": "squeeze",
"jessie": "jessie",
"wheezy": "wheezy",
"squeeze": "squeeze",
// The following release names are not supported, but included of completeness sake
"lenny": "lenny",
"etch": "etch",
"sarge": "sarge",
"woody": "woody",
"potato": "potato",
"slink": "slink",
"hamm": "hamm",
"bo": "bo",
"rex": "rex",
"buzz": "buzz"
}

View file

@ -1,19 +1,12 @@
// This is a mapping of Debian release codenames to NIC configurations
// Every item in an array is a line
{ {
"squeeze": [ "squeeze": ["auto lo",
"auto lo", "iface lo inet loopback",
"iface lo inet loopback", "auto eth0",
"auto eth0", "iface eth0 inet dhcp"],
"iface eth0 inet dhcp" ], "wheezy": ["auto eth0",
"wheezy": [ "iface eth0 inet dhcp"],
"auto eth0", "jessie": ["auto eth0",
"iface eth0 inet dhcp" ], "iface eth0 inet dhcp"]
"jessie": [
"auto eth0",
"iface eth0 inet dhcp" ],
"testing": [
"auto eth0",
"iface eth0 inet dhcp" ],
"unstable": [
"auto eth0",
"iface eth0 inet dhcp" ]
} }

View file

@ -31,7 +31,7 @@ class ConfigureNetworkIF(Task):
def run(cls, info): def run(cls, info):
network_config_path = os.path.join(os.path.dirname(__file__), 'network-configuration.json') network_config_path = os.path.join(os.path.dirname(__file__), 'network-configuration.json')
from common.tools import config_get from common.tools import config_get
if_config = config_get(network_config_path, [info.manifest.system['release']]) if_config = config_get(network_config_path, [info.release_codename])
interfaces_path = os.path.join(info.root, 'etc/network/interfaces') interfaces_path = os.path.join(info.root, 'etc/network/interfaces')
with open(interfaces_path, 'a') as interfaces: with open(interfaces_path, 'a') as interfaces:

View file

@ -1,18 +1,12 @@
// This is a mapping of Debian release codenames to processor architectures to kernel packages
{ {
// In squeeze, we need a special kernel flavor for xen "squeeze": // In squeeze, we need a special kernel flavor for xen
"squeeze": { {"i386": "linux-image-xen-686",
"amd64": "linux-image-xen-amd64", "amd64": "linux-image-xen-amd64"},
"i386" : "linux-image-xen-686" }, "wheezy":
"wheezy": { {"i386": "linux-image-686",
"amd64": "linux-image-amd64", "amd64": "linux-image-amd64"},
"i386" : "linux-image-686" }, "jessie": {
"jessie": { {"i386": "linux-image-686",
"amd64": "linux-image-amd64", "amd64": "linux-image-amd64"},
"i386" : "linux-image-686" },
"testing": {
"amd64": "linux-image-amd64",
"i386" : "linux-image-686" },
"unstable": {
"amd64": "linux-image-amd64",
"i386" : "linux-image-686" }
} }

View file

@ -20,6 +20,6 @@ class DefaultPackages(Task):
import os.path import os.path
kernel_packages_path = os.path.join(os.path.dirname(__file__), 'packages-kernels.json') kernel_packages_path = os.path.join(os.path.dirname(__file__), 'packages-kernels.json')
from common.tools import config_get from common.tools import config_get
kernel_package = config_get(kernel_packages_path, [info.manifest.system['release'], kernel_package = config_get(kernel_packages_path, [info.release_codename,
info.manifest.system['architecture']]) info.manifest.system['architecture']])
info.packages.add(kernel_package) info.packages.add(kernel_package)