bootstrap-vz/providers/ec2/__init__.py

25 lines
894 B
Python
Raw Normal View History

2013-05-16 08:00:28 +02:00
from manifest import Manifest
from tasks import packages
from tasks import connection
from tasks import host
from tasks import ebs
2013-05-16 08:00:28 +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())
from common.tasks import TriggerRollback
tasklist.add(TriggerRollback())
def rollback_tasks(tasklist, tasks_completed, manifest):
completed = [type(task) for task in tasks_completed]
if manifest.volume['backing'].lower() == 'ebs':
if ebs.CreateVolume in completed and ebs.DeleteVolume not in completed:
tasklist.add(ebs.DeleteVolume())
if ebs.AttachVolume in completed and ebs.DetachVolume not in completed:
tasklist.add(ebs.DetachVolume())