bootstrap-vz/plugins/prebootstrapped/__init__.py
Anders Ingemann 9f85cdf909 Remove 'Volume' part from ebs tasks.
It's kind of obvious that we are working with volumes in the ebs module.
2013-07-13 15:12:45 +02:00

33 lines
1 KiB
Python

from tasks import Snapshot
from tasks import CreateFromSnapshot
from providers.ec2.tasks import ebs
def tasks(tasklist, manifest):
from providers.ec2.tasks import bootstrap
from providers.ec2.tasks import filesystem
if manifest.plugins['prebootstrapped']['snapshot'] == "":
tasklist.add(Snapshot())
else:
tasklist.replace(ebs.Create, CreateFromSnapshot())
tasklist.remove(filesystem.FormatVolume,
filesystem.TuneVolumeFS,
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(CreateFromSnapshot, ebs.Delete)
def validate_manifest(data, schema_validate):
from os import path
schema_path = path.normpath(path.join(path.dirname(__file__), 'manifest-schema.json'))
schema_validate(data, schema_path)