Merge pull request #128 from rybaktomasz/unstable

Add ability to create unstable images
This commit is contained in:
Anders Ingemann 2014-01-12 13:11:02 -08:00
commit ce878c745e
7 changed files with 81 additions and 14 deletions

View file

@ -25,7 +25,7 @@
"system": { "system": {
"type": "object", "type": "object",
"properties": { "properties": {
"release": { "enum": ["wheezy"] }, "release": { "enum": ["wheezy", "unstable"] },
"architecture": { "enum": ["i386", "amd64"] }, "architecture": { "enum": ["i386", "amd64"] },
"bootloader": { "enum": ["pvgrub", "grub", "extlinux"] }, "bootloader": { "enum": ["pvgrub", "grub", "extlinux"] },
"timezone": { "type": "string" }, "timezone": { "type": "string" },

View file

@ -25,8 +25,9 @@ class AddDefaultSources(Task):
def run(cls, info): def run(cls, info):
info.source_lists.add('main', 'deb {apt_mirror} {system.release} main') 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-src {apt_mirror} {system.release} main')
info.source_lists.add('main', 'deb {apt_mirror} {system.release}-updates main') if info.manifest.system['release'] != 'unstable':
info.source_lists.add('main', 'deb-src {apt_mirror} {system.release}-updates 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')
class InstallTrustedKeys(Task): class InstallTrustedKeys(Task):

View file

@ -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" ]
}

View file

@ -30,11 +30,9 @@ class ConfigureNetworkIF(Task):
@classmethod @classmethod
def run(cls, info): def run(cls, info):
interfaces_path = os.path.join(info.root, 'etc/network/interfaces') interfaces_path = os.path.join(info.root, 'etc/network/interfaces')
if_config = {'squeeze': ('auto lo\n' if_config = []
'iface lo inet loopback\n' with open('common/tasks/network-configuration.json') as stream:
'auto eth0\n' import json
'iface eth0 inet dhcp\n'), if_config = json.loads(stream.read())
'wheezy': 'auto eth0\n'
'iface eth0 inet dhcp\n'}
with open(interfaces_path, 'a') as interfaces: 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'])))

View file

@ -0,0 +1,44 @@
{
"provider": "ec2",
"virtualization": "pvm",
"credentials": {
// "access-key": null,
// "secret-key": null
},
"bootstrapper": {
"workspace": "/target"
},
"image": {
"name": "debian-{system.release}-{system.architecture}-{virtualization}-{%Y}-{%m}-{%d}-ebs",
"description": "Debian {system.release} {system.architecture}"
},
"system": {
"release": "unstable",
"architecture": "amd64",
"bootloader": "pvgrub",
"timezone": "UTC",
"locale": "en_US",
"charmap": "UTF-8"
},
"packages": {
"mirror": "http://cloudfront.debian.net/debian"
},
"volume": {
"backing": "ebs",
"partitions": {
"type": "none",
"root": {
"size": 8192,
"filesystem": "ext4"
}
}
},
"plugins": {
"cloud_init": {
"username": "admin",
//"metadata_sources": "Ec2",
"disable_modules": [ "landscape", "byobu", "ssh-import-id" ]
}
}
}

View file

@ -0,0 +1,11 @@
{
"squeeze": {
"amd64": "linux-image-xen-amd64",
"i386" : "linux-image-xen-686" },
"wheezy": {
"amd64": "linux-image-amd64",
"i386" : "linux-image-686" },
"unstable": {
"amd64": "linux-image-amd64",
"i386" : "linux-image-686" }
}

View file

@ -18,9 +18,9 @@ class DefaultPackages(Task):
info.exclude_packages.add('isc-dhcp-common') info.exclude_packages.add('isc-dhcp-common')
# In squeeze, we need a special kernel flavor for xen # In squeeze, we need a special kernel flavor for xen
kernels = {'squeeze': {'amd64': 'linux-image-xen-amd64', kernels = {}
'i386': 'linux-image-xen-686', }, with open('providers/ec2/tasks/packages-kernels.json') as stream:
'wheezy': {'amd64': 'linux-image-amd64', import json
'i386': 'linux-image-686', }, } kernels = json.loads(stream.read())
kernel_package = kernels.get(info.manifest.system['release']).get(info.manifest.system['architecture']) kernel_package = kernels.get(info.manifest.system['release']).get(info.manifest.system['architecture'])
info.packages.add(kernel_package) info.packages.add(kernel_package)