New task: AddDefaultSources

This commit is contained in:
Anders Ingemann 2013-12-29 18:11:48 +01:00
parent 4ffb533625
commit 0612987fec
8 changed files with 30 additions and 3 deletions

View file

@ -44,7 +44,8 @@ ssh_set = [security.DisableSSHPasswordAuthentication,
cleanup.ShredHostkeys,
]
apt_set = [apt.WriteSources,
apt_set = [apt.AddDefaultSources,
apt.WriteSources,
apt.DisableDaemonAutostart,
apt.AptUpdate,
apt.AptUpgrade,

View file

@ -5,6 +5,22 @@ import locale
import os
class AddDefaultSources(Task):
description = 'Adding default release sources'
phase = phases.preparation
def run(self, info):
if info.source_lists.target_exists('{system.release}'):
import logging
msg = ('{system.release} target already exists').format(**info.manifest_vars)
logging.getLogger(__name__).info(msg)
else:
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')
class WriteSources(Task):
description = 'Writing aptitude sources to disk'
phase = phases.package_installation

View file

@ -2,6 +2,7 @@ from base import Task
from common import phases
from common.tools import log_check_call
from bootstrap import Bootstrap
from common.tasks import apt
import volume
@ -30,6 +31,7 @@ class TuneVolumeFS(Task):
class AddXFSProgs(Task):
description = 'Adding `xfsprogs\' to the image packages'
phase = phases.preparation
predecessors = [apt.AddDefaultSources]
def run(self, info):
info.packages.add('xfsprogs')

View file

@ -1,12 +1,14 @@
from base import Task
from common import phases
from common.tasks.initd import InstallInitScripts
from common.tasks import apt
import os
class AddSudoPackage(Task):
description = 'Adding ``sudo\'\' to the image packages'
phase = phases.preparation
predecessors = [apt.AddDefaultSources]
def run(self, info):
info.packages.add('sudo')

View file

@ -1,6 +1,7 @@
from base import Task
from common import phases
from common.tools import log_check_call
from common.tasks import apt
import os.path
@ -21,7 +22,7 @@ class AddBackports(Task):
class AddCloudInitPackages(Task):
description = 'Adding cloud-init package and sudo'
phase = phases.preparation
predecessors = [AddBackports]
predecessors = [apt.AddDefaultSources, AddBackports]
def run(self, info):
target = None

View file

@ -1,10 +1,12 @@
from base import Task
from common import phases
from common.tasks import apt
class AddUnattendedUpgradesPackage(Task):
description = 'Adding ``unattended-upgrades\'\' to the image packages'
phase = phases.preparation
predecessors = [apt.AddDefaultSources]
def run(self, info):
info.packages.add('unattended-upgrades')

View file

@ -1,10 +1,12 @@
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]
def run(self, info):
info.packages.add('openssh-server')

View file

@ -1,11 +1,12 @@
from base import Task
from common import phases
from common.tasks import packages
from common.tasks import apt
class DefaultPackages(Task):
description = 'Adding image packages required for virtualbox'
phase = phases.preparation
predecessors = [apt.AddDefaultSources]
def run(self, info):
# Add some basic packages we are going to need