2013-05-16 08:00:28 +02:00
|
|
|
from manifest import Manifest
|
2013-06-26 23:40:42 +02:00
|
|
|
from tasks import packages
|
|
|
|
from tasks import connection
|
|
|
|
from tasks import host
|
|
|
|
from tasks import ebs
|
2013-06-27 00:11:09 +02:00
|
|
|
from tasks import filesystem
|
2013-05-16 08:00:28 +02:00
|
|
|
|
|
|
|
|
2013-06-23 15:26:08 +02:00
|
|
|
def tasks(tasklist, manifest):
|
|
|
|
tasklist.add(packages.HostPackages(), packages.ImagePackages(), host.CheckPackages(),
|
2013-06-23 22:12:29 +02:00
|
|
|
connection.GetCredentials(), host.GetInfo(), connection.Connect())
|
2013-06-24 23:03:43 +02:00
|
|
|
if manifest.volume['backing'].lower() == 'ebs':
|
|
|
|
tasklist.add(ebs.CreateVolume(), ebs.AttachVolume())
|
2013-06-27 00:11:09 +02:00
|
|
|
tasklist.add(filesystem.FormatVolume())
|
|
|
|
if manifest.volume['filesystem'].lower() == 'xfs':
|
|
|
|
tasklist.add(filesystem.AddXFSProgs())
|
|
|
|
import re
|
|
|
|
if re.search('ext.', manifest.volume['filesystem'].lower()):
|
|
|
|
tasklist.add(filesystem.TuneVolumeFS())
|
2013-06-27 22:00:01 +02:00
|
|
|
tasklist.add(filesystem.CreateMountDir(), filesystem.MountVolume())
|
2013-06-24 23:12:39 +02:00
|
|
|
|
|
|
|
from common.tasks import TriggerRollback
|
|
|
|
tasklist.add(TriggerRollback())
|
2013-06-26 23:40:42 +02:00
|
|
|
|
|
|
|
|
|
|
|
def rollback_tasks(tasklist, tasks_completed, manifest):
|
|
|
|
completed = [type(task) for task in tasks_completed]
|
2013-06-27 22:21:43 +02:00
|
|
|
|
|
|
|
def counter_task(task, counter):
|
|
|
|
if task in completed and counter not in completed:
|
|
|
|
tasklist.add(counter())
|
|
|
|
|
2013-06-26 23:40:42 +02:00
|
|
|
if manifest.volume['backing'].lower() == 'ebs':
|
2013-06-27 22:21:43 +02:00
|
|
|
counter_task(ebs.CreateVolume, ebs.DeleteVolume)
|
|
|
|
counter_task(ebs.AttachVolume, ebs.DetachVolume)
|
|
|
|
counter_task(filesystem.CreateMountDir, filesystem.DeleteMountDir)
|
|
|
|
counter_task(filesystem.MountVolume, filesystem.UnmountVolume)
|