2013-12-01 12:26:09 +01:00
|
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
packages = data['plugins']['packages']
|
|
|
|
cloud_init_installed = False
|
|
|
|
if 'remote' in packages:
|
|
|
|
for package in packages['remote']:
|
|
|
|
if isinstance(package, basestring):
|
|
|
|
name = package
|
|
|
|
else:
|
|
|
|
name = package['name']
|
|
|
|
if name == 'cloud-init':
|
|
|
|
cloud_init_installed = True
|
|
|
|
break
|
|
|
|
if not cloud_init_installed:
|
|
|
|
from common.exceptions import ManifestError
|
|
|
|
raise ManifestError('The cloud-init package must be installed for the cloud_init plugin to work')
|
|
|
|
|
|
|
|
|
2013-12-02 00:00:59 +01:00
|
|
|
def resolve_tasks(tasklist, manifest):
|
2013-12-01 12:26:09 +01:00
|
|
|
from tasks import SetUsername
|
2013-12-17 15:51:03 +00:00
|
|
|
from tasks import SetMetadataSource
|
2013-12-01 12:26:09 +01:00
|
|
|
from providers.ec2.tasks.initd import AddEC2InitScripts
|
|
|
|
from common.tasks import initd
|
2013-12-17 15:51:03 +00:00
|
|
|
tasklist.add(SetUsername, SetMetadataSource)
|
2013-12-01 12:26:09 +01:00
|
|
|
tasklist.remove(AddEC2InitScripts,
|
|
|
|
initd.AddExpandRoot,
|
|
|
|
initd.AdjustExpandRootScript,
|
|
|
|
initd.AddSSHKeyGeneration)
|