2014-01-30 11:44:26 +01:00
|
|
|
import tasks.packages
|
2014-03-23 23:12:07 +01:00
|
|
|
from bootstrapvz.common.tasks import volume
|
|
|
|
from bootstrapvz.common.tasks import loopback
|
|
|
|
from bootstrapvz.common.tasks import partitioning
|
|
|
|
from bootstrapvz.common.tasks import filesystem
|
|
|
|
from bootstrapvz.common.tasks import initd
|
2014-05-03 12:56:40 +02:00
|
|
|
from bootstrapvz.common.tasks import ssh
|
2014-03-23 23:12:07 +01:00
|
|
|
from bootstrapvz.common.tasks import workspace
|
2014-01-30 11:44:26 +01:00
|
|
|
|
|
|
|
|
|
|
|
def initialize():
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
if data['volume']['partitions']['type'] == 'none' and data['system']['bootloader'] != 'extlinux':
|
|
|
|
error('Only extlinux can boot from unpartitioned disks', ['system', 'bootloader'])
|
|
|
|
|
|
|
|
|
2014-04-26 17:13:41 -03:00
|
|
|
def resolve_tasks(taskset, manifest):
|
|
|
|
from bootstrapvz.common import task_groups
|
2014-05-03 12:22:51 +02:00
|
|
|
taskset.update(task_groups.get_standard_groups(manifest))
|
2014-04-13 21:18:02 -03:00
|
|
|
|
2014-04-26 17:13:41 -03:00
|
|
|
taskset.update([tasks.packages.DefaultPackages,
|
2014-04-27 11:05:53 -03:00
|
|
|
loopback.Create,
|
|
|
|
initd.InstallInitScripts,
|
2014-05-03 12:56:40 +02:00
|
|
|
ssh.AddOpenSSHPackage,
|
|
|
|
ssh.ShredHostkeys,
|
|
|
|
ssh.AddSSHKeyGeneration,
|
2014-04-27 11:05:53 -03:00
|
|
|
loopback.MoveImage,
|
|
|
|
])
|
2014-01-30 11:44:26 +01:00
|
|
|
|
|
|
|
if manifest.bootstrapper.get('virtio', []):
|
|
|
|
from tasks import virtio
|
2014-04-26 17:13:41 -03:00
|
|
|
taskset.update([virtio.VirtIO])
|
2014-01-30 11:44:26 +01:00
|
|
|
|
|
|
|
|
2014-04-26 17:13:41 -03:00
|
|
|
def resolve_rollback_tasks(taskset, manifest, counter_task):
|
2014-01-30 11:44:26 +01:00
|
|
|
counter_task(loopback.Create, volume.Delete)
|
|
|
|
counter_task(filesystem.CreateMountDir, filesystem.DeleteMountDir)
|
|
|
|
counter_task(partitioning.MapPartitions, partitioning.UnmapPartitions)
|
|
|
|
counter_task(filesystem.MountRoot, filesystem.UnmountRoot)
|
|
|
|
counter_task(volume.Attach, volume.Detach)
|
|
|
|
counter_task(workspace.CreateWorkspace, workspace.DeleteWorkspace)
|