2014-05-03 17:04:37 +02:00
|
|
|
from bootstrapvz.common import task_groups
|
2014-05-02 17:36:08 +02:00
|
|
|
import tasks.apt
|
|
|
|
import tasks.boot
|
|
|
|
import tasks.configuration
|
|
|
|
import tasks.image
|
2014-10-09 21:06:15 -07:00
|
|
|
import tasks.initd
|
2014-05-02 17:36:08 +02:00
|
|
|
import tasks.host
|
|
|
|
import tasks.packages
|
2014-07-12 14:42:52 -03:00
|
|
|
from bootstrapvz.common.tasks import apt
|
2015-01-24 08:17:34 +00:00
|
|
|
from bootstrapvz.common.tasks import boot
|
2014-05-02 17:36:08 +02:00
|
|
|
from bootstrapvz.common.tasks import loopback
|
2014-05-09 00:31:36 -07:00
|
|
|
from bootstrapvz.common.tasks import initd
|
2015-01-29 15:58:46 -08:00
|
|
|
from bootstrapvz.common.tasks import kernel
|
2014-05-03 12:56:40 +02:00
|
|
|
from bootstrapvz.common.tasks import ssh
|
2014-06-07 12:45:58 -03:00
|
|
|
from bootstrapvz.common.tasks import volume
|
2014-05-02 17:36:08 +02:00
|
|
|
|
|
|
|
|
|
|
|
def initialize():
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
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-05-02 17:36:08 +02:00
|
|
|
validator(data, schema_path)
|
|
|
|
|
|
|
|
|
2014-05-03 17:04:37 +02:00
|
|
|
def resolve_tasks(taskset, manifest):
|
|
|
|
taskset.update(task_groups.get_standard_groups(manifest))
|
2014-05-02 17:36:08 +02:00
|
|
|
|
2014-07-12 14:42:52 -03:00
|
|
|
taskset.update([apt.AddBackports,
|
2014-05-22 17:28:17 +02:00
|
|
|
loopback.AddRequiredCommands,
|
2014-05-03 17:04:37 +02:00
|
|
|
loopback.Create,
|
|
|
|
tasks.apt.SetPackageRepositories,
|
|
|
|
tasks.apt.ImportGoogleKey,
|
|
|
|
tasks.packages.DefaultPackages,
|
2014-10-09 21:06:15 -07:00
|
|
|
tasks.packages.ReleasePackages,
|
2014-05-03 17:04:37 +02:00
|
|
|
tasks.packages.GooglePackages,
|
2014-05-02 17:36:08 +02:00
|
|
|
|
2014-05-03 17:04:37 +02:00
|
|
|
tasks.configuration.GatherReleaseInformation,
|
2014-05-02 17:36:08 +02:00
|
|
|
|
2014-05-03 17:04:37 +02:00
|
|
|
tasks.host.DisableIPv6,
|
2014-08-05 16:55:14 -07:00
|
|
|
tasks.host.InstallHostnameHook,
|
2014-05-03 17:04:37 +02:00
|
|
|
tasks.boot.ConfigureGrub,
|
2014-10-09 21:06:15 -07:00
|
|
|
initd.AddExpandRoot,
|
|
|
|
tasks.initd.AdjustExpandRootDev,
|
2014-05-09 00:31:36 -07:00
|
|
|
initd.InstallInitScripts,
|
2015-01-24 08:17:34 +00:00
|
|
|
boot.BlackListModules,
|
|
|
|
boot.UpdateInitramfs,
|
2014-05-03 17:04:37 +02:00
|
|
|
ssh.AddSSHKeyGeneration,
|
2014-08-13 11:51:50 -07:00
|
|
|
ssh.DisableSSHPasswordAuthentication,
|
2014-05-03 17:04:37 +02:00
|
|
|
tasks.apt.CleanGoogleRepositoriesAndKeys,
|
2014-05-02 17:36:08 +02:00
|
|
|
|
2014-05-03 17:04:37 +02:00
|
|
|
loopback.MoveImage,
|
|
|
|
tasks.image.CreateTarball,
|
2014-06-07 12:45:58 -03:00
|
|
|
volume.Delete,
|
2014-05-03 17:04:37 +02:00
|
|
|
])
|
2014-05-02 17:36:08 +02:00
|
|
|
|
2014-10-09 21:06:15 -07:00
|
|
|
if manifest.volume['partitions']['type'] != 'none':
|
|
|
|
taskset.add(initd.AdjustExpandRootScript)
|
|
|
|
|
2015-01-29 15:58:46 -08:00
|
|
|
if manifest.volume['partitions']['type'] != 'mbr':
|
|
|
|
taskset.update([tasks.initd.AddGrowRootDisable,
|
|
|
|
kernel.UpdateInitramfs])
|
|
|
|
|
2014-05-02 17:36:08 +02:00
|
|
|
if 'gcs_destination' in manifest.image:
|
2014-05-03 17:04:37 +02:00
|
|
|
taskset.add(tasks.image.UploadImage)
|
2014-05-02 17:36:08 +02:00
|
|
|
if 'gce_project' in manifest.image:
|
2014-05-03 17:04:37 +02:00
|
|
|
taskset.add(tasks.image.RegisterImage)
|
2014-05-02 17:36:08 +02:00
|
|
|
|
|
|
|
|
2014-05-03 17:04:37 +02:00
|
|
|
def resolve_rollback_tasks(taskset, manifest, completed, counter_task):
|
2014-05-03 13:28:24 +02:00
|
|
|
taskset.update(task_groups.get_standard_rollback_tasks(completed))
|