bootstrap-vz/plugins/vagrant/__init__.py
Anders Ingemann a4ead02a9b Remove provider specific manifests
Manifest and module loading has been refactored
Provider modules now must implement validate_manifest like plugins do
Simplified loading of manifests
2014-01-05 14:03:04 +01:00

33 lines
1,002 B
Python

import tasks
def validate_manifest(data, validator, error):
import os.path
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.json'))
validator(data, schema_path)
def resolve_tasks(tasklist, manifest):
from common.tasks import security
from common.tasks import loopback
tasklist.remove(security.DisableSSHPasswordAuthentication,
loopback.MoveImage,
)
from common.tasks import volume
tasklist.add(tasks.CreateVagrantBoxDir,
tasks.AddPackages,
tasks.AddInsecurePublicKey,
tasks.PackageBox,
tasks.RemoveVagrantBoxDir,
volume.Delete,
)
def resolve_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(tasks.CreateVagrantBoxDir, tasks.RemoveVagrantBoxDir)