2013-12-01 12:26:09 +01:00
|
|
|
|
|
|
|
|
2014-01-05 14:03:04 +01:00
|
|
|
def validate_manifest(data, validator, error):
|
|
|
|
import os.path
|
2014-07-05 20:01:20 +02:00
|
|
|
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
2014-01-05 14:03:04 +01:00
|
|
|
validator(data, schema_path)
|
2013-12-01 12:26:09 +01:00
|
|
|
|
|
|
|
|
2014-01-05 15:13:09 +01:00
|
|
|
def resolve_tasks(taskset, manifest):
|
2013-12-29 17:45:23 +01:00
|
|
|
import tasks
|
2014-03-23 23:12:07 +01:00
|
|
|
import bootstrapvz.providers.ec2.tasks.initd as initd_ec2
|
|
|
|
from bootstrapvz.common.tasks import initd
|
2014-05-03 12:56:40 +02:00
|
|
|
from bootstrapvz.common.tasks import ssh
|
2013-12-25 12:47:17 +00:00
|
|
|
|
2014-07-06 20:23:48 +02:00
|
|
|
from bootstrapvz.common.tools import get_codename
|
|
|
|
if get_codename(manifest.system['release']) == 'wheezy':
|
2014-01-05 15:13:09 +01:00
|
|
|
taskset.add(tasks.AddBackports)
|
2013-12-29 17:45:23 +01:00
|
|
|
|
2014-04-10 00:27:37 +02:00
|
|
|
taskset.update([tasks.SetMetadataSource,
|
|
|
|
tasks.AddCloudInitPackages,
|
2014-01-05 15:13:09 +01:00
|
|
|
])
|
2013-12-29 17:45:23 +01:00
|
|
|
|
2013-12-25 12:47:17 +00:00
|
|
|
options = manifest.plugins['cloud_init']
|
|
|
|
if 'username' in options:
|
2014-01-05 15:13:09 +01:00
|
|
|
taskset.add(tasks.SetUsername)
|
2013-12-25 12:47:17 +00:00
|
|
|
if 'disable_modules' in options:
|
2014-01-05 15:13:09 +01:00
|
|
|
taskset.add(tasks.DisableModules)
|
2013-12-25 12:47:17 +00:00
|
|
|
|
2014-01-05 15:13:09 +01:00
|
|
|
taskset.discard(initd_ec2.AddEC2InitScripts)
|
|
|
|
taskset.discard(initd.AddExpandRoot)
|
|
|
|
taskset.discard(initd.AdjustExpandRootScript)
|
2014-05-03 12:56:40 +02:00
|
|
|
taskset.discard(ssh.AddSSHKeyGeneration)
|