2013-07-10 10:49:45 +02:00
|
|
|
from manifest import Manifest
|
|
|
|
from tasks import packages
|
2013-09-15 13:19:45 +02:00
|
|
|
from common.tasks import volume as volume_tasks
|
2013-08-11 15:54:04 +02:00
|
|
|
from common.tasks import loopback
|
2013-09-15 13:19:45 +02:00
|
|
|
from common.tasks import partitioning
|
2013-08-10 20:03:20 +02:00
|
|
|
from common.tasks import filesystem
|
2013-08-10 16:22:16 +02:00
|
|
|
from common.tasks import bootstrap
|
2013-12-01 23:50:32 +01:00
|
|
|
from common.tasks import boot
|
2013-08-10 17:12:58 +02:00
|
|
|
from common.tasks import security
|
2013-08-10 16:27:43 +02:00
|
|
|
from common.tasks import network
|
2013-08-10 16:55:27 +02:00
|
|
|
from common.tasks import initd
|
2013-08-10 16:24:12 +02:00
|
|
|
from common.tasks import cleanup
|
2013-09-15 16:59:56 +02:00
|
|
|
from common.tasks import workspace
|
2013-07-10 10:49:45 +02:00
|
|
|
|
2013-08-10 16:18:48 +02:00
|
|
|
|
2013-07-10 10:49:45 +02:00
|
|
|
def initialize():
|
2013-08-10 16:56:14 +02:00
|
|
|
pass
|
2013-07-10 10:49:45 +02:00
|
|
|
|
|
|
|
|
2013-12-02 00:00:59 +01:00
|
|
|
def resolve_tasks(tasklist, manifest):
|
2013-09-22 20:46:25 +02:00
|
|
|
from common.task_sets import base_set
|
|
|
|
from common.task_sets import volume_set
|
|
|
|
from common.task_sets import mounting_set
|
|
|
|
from common.task_sets import apt_set
|
|
|
|
from common.task_sets import locale_set
|
|
|
|
tasklist.add(*base_set)
|
|
|
|
tasklist.add(*volume_set)
|
|
|
|
tasklist.add(*mounting_set)
|
|
|
|
tasklist.add(*apt_set)
|
|
|
|
tasklist.add(*locale_set)
|
|
|
|
|
|
|
|
if manifest.volume['partitions']['type'] != 'none':
|
|
|
|
from common.task_sets import partitioning_set
|
|
|
|
tasklist.add(*partitioning_set)
|
|
|
|
|
2013-10-27 13:01:01 +01:00
|
|
|
tasklist.add(packages.ImagePackages,
|
2013-08-10 17:52:24 +02:00
|
|
|
|
2013-09-22 17:31:43 +02:00
|
|
|
loopback.Create,
|
2013-08-10 17:52:24 +02:00
|
|
|
|
2013-12-01 23:50:32 +01:00
|
|
|
boot.InstallGrub,
|
2013-09-22 17:31:43 +02:00
|
|
|
security.EnableShadowConfig,
|
|
|
|
network.RemoveDNSInfo,
|
|
|
|
network.ConfigureNetworkIF,
|
|
|
|
network.RemoveHostname,
|
2013-12-01 14:34:38 +01:00
|
|
|
initd.AddSSHKeyGeneration,
|
2013-09-22 17:31:43 +02:00
|
|
|
initd.InstallInitScripts,
|
|
|
|
cleanup.ClearMOTD,
|
|
|
|
cleanup.CleanTMP,
|
2013-09-22 20:46:25 +02:00
|
|
|
|
2013-10-04 21:13:41 +02:00
|
|
|
loopback.MoveImage)
|
2013-08-10 17:52:24 +02:00
|
|
|
|
2013-09-15 16:59:56 +02:00
|
|
|
if manifest.bootstrapper.get('tarball', False):
|
2013-09-22 17:31:43 +02:00
|
|
|
tasklist.add(bootstrap.MakeTarball)
|
2013-08-10 17:52:24 +02:00
|
|
|
|
2013-10-06 01:42:32 +02:00
|
|
|
from common.task_sets import get_fs_specific_set
|
|
|
|
tasklist.add(*get_fs_specific_set(manifest.volume['partitions']))
|
2013-09-15 13:19:45 +02:00
|
|
|
|
|
|
|
if 'boot' in manifest.volume['partitions']:
|
2013-09-22 20:46:25 +02:00
|
|
|
from common.task_sets import boot_partition_set
|
|
|
|
tasklist.add(*boot_partition_set)
|
2013-07-10 10:49:45 +02:00
|
|
|
|
|
|
|
|
2013-12-02 00:00:59 +01:00
|
|
|
def resolve_rollback_tasks(tasklist, tasks_completed, manifest):
|
2013-07-10 10:49:45 +02:00
|
|
|
completed = [type(task) for task in tasks_completed]
|
|
|
|
|
|
|
|
def counter_task(task, counter):
|
|
|
|
if task in completed and counter not in completed:
|
2013-09-22 17:31:43 +02:00
|
|
|
tasklist.add(counter)
|
2013-07-10 10:49:45 +02:00
|
|
|
|
2013-09-15 13:19:45 +02:00
|
|
|
counter_task(loopback.Create, volume_tasks.Delete)
|
2013-08-10 20:03:20 +02:00
|
|
|
counter_task(filesystem.CreateMountDir, filesystem.DeleteMountDir)
|
2013-09-15 13:19:45 +02:00
|
|
|
counter_task(partitioning.MapPartitions, partitioning.UnmapPartitions)
|
|
|
|
counter_task(filesystem.MountRoot, filesystem.UnmountRoot)
|
|
|
|
counter_task(volume_tasks.Attach, volume_tasks.Detach)
|
2013-09-15 16:59:56 +02:00
|
|
|
counter_task(workspace.CreateWorkspace, workspace.DeleteWorkspace)
|