diff options
author | Lars Wirzenius <liw@liw.fi> | 2018-08-19 14:13:20 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2018-08-19 14:13:20 +0300 |
commit | 7a56a882eb6164db7ee95126d741f1bd21f70941 (patch) | |
tree | 50dad811ce52b71bea6af4b516a6898fbf56ac3a | |
parent | 2429d92b4a598ecedbab8124bb82c5c34c07bd3c (diff) | |
download | vmdb2-7a56a882eb6164db7ee95126d741f1bd21f70941.tar.gz |
Fix: bugs, plus put back compatibiliy with old tag field names
-rw-r--r-- | vmdb/plugins/apt_plugin.py | 4 | ||||
-rw-r--r-- | vmdb/plugins/chroot_plugin.py | 2 | ||||
-rw-r--r-- | vmdb/plugins/debootstrap_plugin.py | 2 | ||||
-rw-r--r-- | vmdb/plugins/grub_plugin.py | 11 | ||||
-rw-r--r-- | vmdb/plugins/partition_plugin.py | 15 | ||||
-rw-r--r-- | vmdb/plugins/qemudebootstrap_plugin.py | 2 | ||||
-rw-r--r-- | vmdb/plugins/rootfs_cache_plugin.py | 2 | ||||
-rw-r--r-- | vmdb/plugins/virtuals_plugin.py | 2 |
8 files changed, 22 insertions, 18 deletions
diff --git a/vmdb/plugins/apt_plugin.py b/vmdb/plugins/apt_plugin.py index a32fe1e..92b6378 100644 --- a/vmdb/plugins/apt_plugin.py +++ b/vmdb/plugins/apt_plugin.py @@ -41,7 +41,9 @@ class AptStepRunner(vmdb.StepRunnerInterface): raise Exception('"apt" must always have value "install"') packages = step['packages'] - tag = step['tag'] + tag = step.get('tag') + if tag is None: + tag = step['fs-tag'] mount_point = state.tags.get_mount_point(tag) if not self.got_eatmydata(state): diff --git a/vmdb/plugins/chroot_plugin.py b/vmdb/plugins/chroot_plugin.py index a7cda6d..9e4fee0 100644 --- a/vmdb/plugins/chroot_plugin.py +++ b/vmdb/plugins/chroot_plugin.py @@ -54,5 +54,5 @@ class ShellStepRunner(vmdb.StepRunnerInterface): fs_tag = step['root-fs'] env = dict(os.environ) - env['ROOT'] = state.get_mount_point(fs_tag) + env['ROOT'] = state.tags.get_mount_point(fs_tag) vmdb.runcmd(['sh', '-c', shell], env=env) diff --git a/vmdb/plugins/debootstrap_plugin.py b/vmdb/plugins/debootstrap_plugin.py index 3411bb8..91fc8d1 100644 --- a/vmdb/plugins/debootstrap_plugin.py +++ b/vmdb/plugins/debootstrap_plugin.py @@ -36,7 +36,7 @@ class DebootstrapStepRunner(vmdb.StepRunnerInterface): def run(self, step, settings, state): suite = step['debootstrap'] tag = step['target'] - target = state.get_mount_point(tag) + target = state.tags.get_mount_point(tag) mirror = step['mirror'] variant = step.get('variant', '-') if not (suite and tag and target and mirror): diff --git a/vmdb/plugins/grub_plugin.py b/vmdb/plugins/grub_plugin.py index 55411c6..d5ffd3c 100644 --- a/vmdb/plugins/grub_plugin.py +++ b/vmdb/plugins/grub_plugin.py @@ -100,8 +100,8 @@ class GrubStepRunner(vmdb.StepRunnerInterface): raise Exception('Unknown GRUB flavor {}'.format(flavor)) def install_uefi(self, step, settings, state): - if not 'efi' in step: - raise Exception('"efi" is required in UEFI GRUB installtion') + if not 'efi' in step and 'efi-part' not in step: + raise Exception('"efi" or "efi-part" required in UEFI GRUB installtion') vmdb.progress('Installing GRUB for UEFI') grub_package = 'grub-efi-amd64' @@ -117,7 +117,9 @@ class GrubStepRunner(vmdb.StepRunnerInterface): def install_grub(self, step, settings, state, grub_package, grub_target): console = step.get('console', None) - tag = step['tag'] + tag = step.get('tag') + if tag is None: + tag = step['root-fs'] root_dev = state.tags.get_dev(tag) chroot = state.tags.get_mount_point(tag) @@ -128,6 +130,9 @@ class GrubStepRunner(vmdb.StepRunnerInterface): if 'efi' in step: efi = step['efi'] efi_dev = state.tags.get_dev(efi) + elif 'efi-part' in step: + efi = step['efi-part'] + efi_dev = state.tags.get_dev(efi) else: efi_dev = None diff --git a/vmdb/plugins/partition_plugin.py b/vmdb/plugins/partition_plugin.py index a18055c..39a8afb 100644 --- a/vmdb/plugins/partition_plugin.py +++ b/vmdb/plugins/partition_plugin.py @@ -54,24 +54,21 @@ class MkpartStepRunner(vmdb.StepRunnerInterface): device = step['device'] start = step['start'] end = step['end'] - part_tag = step['tag'] + tag = step.get('tag') + if tag is None: + tag = step['part-tag'] fs_type = step.get('fs-type', 'ext2') - vmdb.progress( - 'Creating partition ({}) on {} ({} to {})'.format( - part_type, device, start, end)) - orig = self.list_partitions(device) vmdb.runcmd(['parted', '-s', device, 'mkpart', part_type, fs_type, start, end]) - state.tags.append(part_tag) + state.tags.append(tag) if self.is_block_dev(device): new = self.list_partitions(device) diff = self.diff_partitions(orig, new) - print('diff:', diff) assert len(diff) == 1 - vmdb.progress('remembering partition', part_dev, 'as', part_tag) - state.tags.set_dev(part_tag, diff[0]) + vmdb.progress('remembering partition', diff[0], 'as', tag) + state.tags.set_dev(tag, diff[0]) def is_block_dev(self, filename): st = os.lstat(filename) diff --git a/vmdb/plugins/qemudebootstrap_plugin.py b/vmdb/plugins/qemudebootstrap_plugin.py index 358790b..53a1835 100644 --- a/vmdb/plugins/qemudebootstrap_plugin.py +++ b/vmdb/plugins/qemudebootstrap_plugin.py @@ -36,7 +36,7 @@ class QemuDebootstrapStepRunner(vmdb.StepRunnerInterface): def run(self, step, settings, state): suite = step['qemu-debootstrap'] tag = step['target'] - target = state.get_mount_point(tag) + target = state.tags.get_mount_point(tag) mirror = step['mirror'] variant = step.get('variant', '-') arch = step['arch'] diff --git a/vmdb/plugins/rootfs_cache_plugin.py b/vmdb/plugins/rootfs_cache_plugin.py index 0d6df1c..311f478 100644 --- a/vmdb/plugins/rootfs_cache_plugin.py +++ b/vmdb/plugins/rootfs_cache_plugin.py @@ -43,7 +43,7 @@ class MakeCacheStepRunner(vmdb.StepRunnerInterface): def run(self, step, settings, state): fs_tag = step['cache-rootfs'] - rootdir = state.get_mount_point(fs_tag) + rootdir = state.tags.get_mount_point(fs_tag) tar_path = settings['rootfs-tarball'] opts = step.get('options', '--one-file-system').split() if not tar_path: diff --git a/vmdb/plugins/virtuals_plugin.py b/vmdb/plugins/virtuals_plugin.py index 217d7ee..5c567cf 100644 --- a/vmdb/plugins/virtuals_plugin.py +++ b/vmdb/plugins/virtuals_plugin.py @@ -48,7 +48,7 @@ class VirtualFilesystemMountStepRunner(vmdb.StepRunnerInterface): def run(self, step, settings, state): fstag = step['mount-virtual-filesystems'] - mount_point = state.get_mount_point(fstag) + mount_point = state.tags.get_mount_point(fstag) self.mount_virtuals(mount_point, state) def teardown(self, step, settings, state): |