Rollback task for prebootstrapped plugin

This commit is contained in:
Anders Ingemann 2013-07-01 00:17:48 +02:00
parent 6dfdc2ed6d
commit 0c1677eef2

View file

@ -1,8 +1,8 @@
from tasks import CreateVolumeFromSnapshot
from providers.ec2.tasks import ebs
def tasks(tasklist, manifest):
from tasks import CreateVolumeFromSnapshot
from providers.ec2.tasks import ebs
from providers.ec2.tasks import bootstrap
from providers.ec2.tasks import filesystem
tasklist.replace(ebs.CreateVolume, CreateVolumeFromSnapshot())
@ -11,3 +11,13 @@ def tasks(tasklist, manifest):
filesystem.AddXFSProgs,
bootstrap.MakeTarball,
bootstrap.Bootstrap)
def rollback_tasks(tasklist, tasks_completed, manifest):
completed = [type(task) for task in tasks_completed]
def counter_task(task, counter):
if task in completed and counter not in completed:
tasklist.add(counter())
counter_task(ebs.CreateVolumeFromSnapshot, ebs.DeleteVolume)