mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-22 09:50:37 +00:00
Changes 'MoveImage' from loopback
to image
This commit is contained in:
parent
10742f8ca3
commit
3d3c303ee1
8 changed files with 39 additions and 33 deletions
21
bootstrapvz/common/tasks/image.py
Normal file
21
bootstrapvz/common/tasks/image.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
from bootstrapvz.base import Task
|
||||
from bootstrapvz.common import phases
|
||||
|
||||
|
||||
class MoveImage(Task):
|
||||
description = 'Moving volume image'
|
||||
phase = phases.image_registration
|
||||
|
||||
@classmethod
|
||||
def run(cls, info):
|
||||
image_name = info.manifest.image['name'].format(**info.manifest_vars)
|
||||
filename = image_name + '.' + info.volume.extension
|
||||
|
||||
import os.path
|
||||
destination = os.path.join(info.manifest.bootstrapper['workspace'], filename)
|
||||
import shutil
|
||||
shutil.move(info.volume.image_path, destination)
|
||||
info.volume.image_path = destination
|
||||
import logging
|
||||
log = logging.getLogger(__name__)
|
||||
log.info('The volume image has been moved to ' + destination)
|
|
@ -1,5 +1,5 @@
|
|||
from bootstrapvz.base import Task
|
||||
from .. import phases
|
||||
from bootstrapvz.common import phases
|
||||
import host
|
||||
import volume
|
||||
|
||||
|
@ -30,22 +30,3 @@ class Create(Task):
|
|||
import os.path
|
||||
image_path = os.path.join(info.workspace, 'volume.' + info.volume.extension)
|
||||
info.volume.create(image_path)
|
||||
|
||||
|
||||
class MoveImage(Task):
|
||||
description = 'Moving volume image'
|
||||
phase = phases.image_registration
|
||||
|
||||
@classmethod
|
||||
def run(cls, info):
|
||||
image_name = info.manifest.image['name'].format(**info.manifest_vars)
|
||||
filename = image_name + '.' + info.volume.extension
|
||||
|
||||
import os.path
|
||||
destination = os.path.join(info.manifest.bootstrapper['workspace'], filename)
|
||||
import shutil
|
||||
shutil.move(info.volume.image_path, destination)
|
||||
info.volume.image_path = destination
|
||||
import logging
|
||||
log = logging.getLogger(__name__)
|
||||
log.info('The volume image has been moved to ' + destination)
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
import tasks
|
||||
from bootstrapvz.common import task_groups
|
||||
from bootstrapvz.common.tasks import image
|
||||
from bootstrapvz.common.tasks import ssh
|
||||
from bootstrapvz.common.tasks import volume
|
||||
import os
|
||||
|
||||
|
||||
def validate_manifest(data, validator, error):
|
||||
import os.path
|
||||
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
||||
validator(data, schema_path)
|
||||
|
||||
|
||||
def resolve_tasks(taskset, manifest):
|
||||
from bootstrapvz.common import task_groups
|
||||
from bootstrapvz.common.tasks import ssh
|
||||
taskset.update(task_groups.ssh_group)
|
||||
|
||||
taskset.discard(image.MoveImage)
|
||||
taskset.discard(ssh.DisableSSHPasswordAuthentication)
|
||||
|
||||
from bootstrapvz.common.tasks import loopback
|
||||
taskset.discard(loopback.MoveImage)
|
||||
|
||||
from bootstrapvz.common.tasks import volume
|
||||
taskset.update([tasks.CheckBoxPath,
|
||||
tasks.CreateVagrantBoxDir,
|
||||
tasks.AddPackages,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from bootstrapvz.common import task_groups
|
||||
import tasks.packages
|
||||
import tasks.boot
|
||||
from bootstrapvz.common.tasks import image
|
||||
from bootstrapvz.common.tasks import loopback
|
||||
from bootstrapvz.common.tasks import initd
|
||||
from bootstrapvz.common.tasks import ssh
|
||||
|
@ -19,7 +20,7 @@ def resolve_tasks(taskset, manifest):
|
|||
tasks.packages.DefaultPackages,
|
||||
loopback.AddRequiredCommands,
|
||||
loopback.Create,
|
||||
loopback.MoveImage,
|
||||
image.MoveImage,
|
||||
initd.InstallInitScripts,
|
||||
ssh.AddOpenSSHPackage,
|
||||
ssh.ShredHostkeys,
|
||||
|
|
|
@ -8,6 +8,7 @@ import tasks.host
|
|||
import tasks.packages
|
||||
from bootstrapvz.common.tasks import apt
|
||||
from bootstrapvz.common.tasks import boot
|
||||
from bootstrapvz.common.tasks import image
|
||||
from bootstrapvz.common.tasks import loopback
|
||||
from bootstrapvz.common.tasks import initd
|
||||
from bootstrapvz.common.tasks import kernel
|
||||
|
@ -47,7 +48,7 @@ def resolve_tasks(taskset, manifest):
|
|||
ssh.DisableSSHPasswordAuthentication,
|
||||
tasks.apt.CleanGoogleRepositoriesAndKeys,
|
||||
|
||||
loopback.MoveImage,
|
||||
image.MoveImage,
|
||||
tasks.image.CreateTarball,
|
||||
volume.Delete,
|
||||
])
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from bootstrapvz.base import Task
|
||||
from bootstrapvz.common import phases
|
||||
from bootstrapvz.common.tasks import loopback
|
||||
from bootstrapvz.common.tasks import image
|
||||
from bootstrapvz.common.tools import log_check_call
|
||||
import os.path
|
||||
|
||||
|
@ -8,7 +8,7 @@ import os.path
|
|||
class CreateTarball(Task):
|
||||
description = 'Creating tarball with image'
|
||||
phase = phases.image_registration
|
||||
predecessors = [loopback.MoveImage]
|
||||
predecessors = [image.MoveImage]
|
||||
|
||||
@classmethod
|
||||
def run(cls, info):
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
from bootstrapvz.common import task_groups
|
||||
import tasks.packages
|
||||
from bootstrapvz.common.tasks import image
|
||||
from bootstrapvz.common.tasks import loopback
|
||||
from bootstrapvz.common.tasks import initd
|
||||
from bootstrapvz.common.tasks import ssh
|
||||
|
@ -21,7 +22,7 @@ def resolve_tasks(taskset, manifest):
|
|||
ssh.AddOpenSSHPackage,
|
||||
ssh.ShredHostkeys,
|
||||
ssh.AddSSHKeyGeneration,
|
||||
loopback.MoveImage,
|
||||
image.MoveImage,
|
||||
])
|
||||
|
||||
if manifest.provider.get('virtio', []):
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
from bootstrapvz.common import task_groups
|
||||
import tasks.packages
|
||||
from bootstrapvz.common.tasks import image
|
||||
from bootstrapvz.common.tasks import loopback
|
||||
|
||||
|
||||
|
@ -15,7 +16,7 @@ def resolve_tasks(taskset, manifest):
|
|||
taskset.update([tasks.packages.DefaultPackages,
|
||||
loopback.AddRequiredCommands,
|
||||
loopback.Create,
|
||||
loopback.MoveImage,
|
||||
image.MoveImage,
|
||||
])
|
||||
|
||||
if manifest.provider.get('guest_additions', False):
|
||||
|
|
Loading…
Add table
Reference in a new issue