diff --git a/providers/ec2/__init__.py b/providers/ec2/__init__.py index 3ffed53..476932c 100644 --- a/providers/ec2/__init__.py +++ b/providers/ec2/__init__.py @@ -32,6 +32,7 @@ def tasks(tasklist, manifest): tasklist.add(filesystem.MountSpecials()) tasklist.add(config.GenerateLocale()) tasklist.add(config.SetTimezone()) + tasklist.add(config.AptSources()) from common.tasks import TriggerRollback tasklist.add(TriggerRollback()) diff --git a/providers/ec2/tasks/config.py b/providers/ec2/tasks/config.py index db478fd..94738ef 100644 --- a/providers/ec2/tasks/config.py +++ b/providers/ec2/tasks/config.py @@ -33,3 +33,20 @@ class SetTimezone(Task): zoneinfo_path = os.path.join(info.root, '/usr/share/zoneinfo', timezone) localtime_path = os.path.join(info.root, 'etc/localtime') copy(zoneinfo_path, localtime_path) + + +class AptSources(Task): + description = 'Adding aptitude sources' + phase = phases.system_modification + + def run(self, info): + sources_path = os.path.join(info.root, 'etc/apt/sources.list') + with open(sources_path, 'w') as apt_sources: + apt_sources.write(('deb {apt_mirror} {release} main\n' + 'deb-src {apt_mirror} {release} main\n'. + format(apt_mirror='http://http.debian.net/debian', + release=info.manifest.system['release']))) + apt_sources.write(('deb {apt_mirror} {release}/updates main\n' + 'deb-src {apt_mirror} {release}/updates main\n'. + format(apt_mirror='http://security.debian.org/', + release=info.manifest.system['release'])))