bootstrap-vz/providers/ec2/tasks/packages.py
Anders Ingemann 0092e1c2c2 Don't instantiate tasks
In practice they are just typed functions with attributes, having a reference to an object is just confusing.
So: Task.run() is now a classmethod
2014-01-06 22:58:21 +01:00

26 lines
971 B
Python

from base import Task
from common import phases
from common.tasks import apt
class DefaultPackages(Task):
description = 'Adding image packages required for EC2'
phase = phases.preparation
predecessors = [apt.AddDefaultSources]
@classmethod
def run(cls, info):
info.packages.add('openssh-server')
info.packages.add('file') # Needed for the init scripts
info.packages.add('dhcpcd') # isc-dhcp-client doesn't work properly with ec2
info.exclude_packages.add('isc-dhcp-client')
info.exclude_packages.add('isc-dhcp-common')
# In squeeze, we need a special kernel flavor for xen
kernels = {'squeeze': {'amd64': 'linux-image-xen-amd64',
'i386': 'linux-image-xen-686', },
'wheezy': {'amd64': 'linux-image-amd64',
'i386': 'linux-image-686', }, }
kernel_package = kernels.get(info.manifest.system['release']).get(info.manifest.system['architecture'])
info.packages.add(kernel_package)