From fc0c174d798c8ddb8adb3048c8a5caf5b21415b8 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Thu, 26 Dec 2019 17:50:07 +0200 Subject: Refactor: rename get_mount_point to set_builder_mount_point --- vmdb/plugins/ansible_plugin.py | 2 +- vmdb/plugins/apt_plugin.py | 2 +- vmdb/plugins/chroot_plugin.py | 4 ++-- vmdb/plugins/debootstrap_plugin.py | 4 ++-- vmdb/plugins/files_plugin.py | 6 +++--- vmdb/plugins/fstab_plugin.py | 2 +- vmdb/plugins/grub_plugin.py | 2 +- vmdb/plugins/luks_plugin.py | 2 +- vmdb/plugins/mount_plugin.py | 4 ++-- vmdb/plugins/qemudebootstrap_plugin.py | 4 ++-- vmdb/plugins/rootfs_cache_plugin.py | 8 ++++---- vmdb/plugins/virtuals_plugin.py | 2 +- vmdb/tags.py | 2 +- vmdb/tags_tests.py | 6 +++--- 14 files changed, 25 insertions(+), 25 deletions(-) diff --git a/vmdb/plugins/ansible_plugin.py b/vmdb/plugins/ansible_plugin.py index cedf24d..edce52f 100644 --- a/vmdb/plugins/ansible_plugin.py +++ b/vmdb/plugins/ansible_plugin.py @@ -39,7 +39,7 @@ class AnsibleStepRunner(vmdb.StepRunnerInterface): def run(self, step, settings, state): tag = step['ansible'] playbook = step['playbook'] - mount_point = state.tags.get_mount_point(tag) + mount_point = state.tags.get_builder_mount_point(tag) rootfs_tarball = settings['rootfs-tarball'] state.ansible_inventory = self.create_inventory(mount_point) diff --git a/vmdb/plugins/apt_plugin.py b/vmdb/plugins/apt_plugin.py index 22177dc..7356369 100644 --- a/vmdb/plugins/apt_plugin.py +++ b/vmdb/plugins/apt_plugin.py @@ -44,7 +44,7 @@ class AptStepRunner(vmdb.StepRunnerInterface): tag = step.get('tag') if tag is None: tag = step['fs-tag'] - mount_point = state.tags.get_mount_point(tag) + mount_point = state.tags.get_builder_mount_point(tag) if not self.got_eatmydata(state): self.install_packages(mount_point, [], ['eatmydata']) diff --git a/vmdb/plugins/chroot_plugin.py b/vmdb/plugins/chroot_plugin.py index bb28a98..1304e31 100644 --- a/vmdb/plugins/chroot_plugin.py +++ b/vmdb/plugins/chroot_plugin.py @@ -40,7 +40,7 @@ class ChrootStepRunner(vmdb.StepRunnerInterface): fs_tag = step['chroot'] shell = step['shell'] - mount_point = state.tags.get_mount_point(fs_tag) + mount_point = state.tags.get_builder_mount_point(fs_tag) vmdb.runcmd_chroot(mount_point, ['sh', '-ec', shell]) @@ -54,5 +54,5 @@ class ShellStepRunner(vmdb.StepRunnerInterface): fs_tag = step['root-fs'] env = dict(os.environ) - env['ROOT'] = state.tags.get_mount_point(fs_tag) + env['ROOT'] = state.tags.get_builder_mount_point(fs_tag) vmdb.runcmd(['sh', '-ec', shell], env=env) diff --git a/vmdb/plugins/debootstrap_plugin.py b/vmdb/plugins/debootstrap_plugin.py index 1a59063..cf2fb43 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.tags.get_mount_point(tag) + target = state.tags.get_builder_mount_point(tag) mirror = step['mirror'] keyring = step.get('keyring', None) variant = step.get('variant', '-') @@ -49,5 +49,5 @@ class DebootstrapStepRunner(vmdb.StepRunnerInterface): def run_even_if_skipped(self, step, settings, state): tag = step['target'] - target = state.tags.get_mount_point(tag) + target = state.tags.get_builder_mount_point(tag) vmdb.runcmd_chroot(target, ['apt-get', 'update']) diff --git a/vmdb/plugins/files_plugin.py b/vmdb/plugins/files_plugin.py index 772443c..c4b33e9 100644 --- a/vmdb/plugins/files_plugin.py +++ b/vmdb/plugins/files_plugin.py @@ -34,7 +34,7 @@ class CreateFileStepRunner(vmdb.StepRunnerInterface): return ['create-file', 'contents'] def run(self, step, settings, state): - root = state.tags.get_mount_point('/') + root = state.tags.get_builder_mount_point('/') newfile = step['create-file'] contents = step['contents'] perm = step.get('perm', 0o644) @@ -58,7 +58,7 @@ class CopyFileStepRunner(vmdb.StepRunnerInterface): return ['copy-file', 'src'] def run(self, step, settings, state): - root = state.tags.get_mount_point('/') + root = state.tags.get_builder_mount_point('/') newfile = step['copy-file'] src = step['src'] perm = step.get('perm', 0o644) @@ -88,7 +88,7 @@ class CreateDirStepRunner(vmdb.StepRunnerInterface): return ['create-dir'] def run(self, step, settings, state): - root = state.tags.get_mount_point('/') + root = state.tags.get_builder_mount_point('/') newdir = step['create-dir'] path = '/'.join([root, newdir]) perm = step.get('perm', 0o755) diff --git a/vmdb/plugins/fstab_plugin.py b/vmdb/plugins/fstab_plugin.py index 2f82155..e0bd29d 100644 --- a/vmdb/plugins/fstab_plugin.py +++ b/vmdb/plugins/fstab_plugin.py @@ -35,7 +35,7 @@ class FstabStepRunner(vmdb.StepRunnerInterface): def run(self, step, setting, state): tag = step['fstab'] - chroot = state.tags.get_mount_point(tag) + chroot = state.tags.get_builder_mount_point(tag) filesystems = [] diff --git a/vmdb/plugins/grub_plugin.py b/vmdb/plugins/grub_plugin.py index 64522ec..3943f9b 100644 --- a/vmdb/plugins/grub_plugin.py +++ b/vmdb/plugins/grub_plugin.py @@ -121,7 +121,7 @@ class GrubStepRunner(vmdb.StepRunnerInterface): if tag is None: tag = step['root-fs'] root_dev = state.tags.get_dev(tag) - chroot = state.tags.get_mount_point(tag) + chroot = state.tags.get_builder_mount_point(tag) image_dev = step.get('image-dev') if image_dev is None: diff --git a/vmdb/plugins/luks_plugin.py b/vmdb/plugins/luks_plugin.py index 69b0f54..c95d07f 100644 --- a/vmdb/plugins/luks_plugin.py +++ b/vmdb/plugins/luks_plugin.py @@ -67,7 +67,7 @@ class CryptsetupStepRunner(vmdb.StepRunnerInterface): for t in state.tags.get_tags(): logging.debug( 'tag %r dev %r mp %r', t, state.tags.get_dev(t), - state.tags.get_mount_point(t)) + state.tags.get_builder_mount_point(t)) assert 0 vmdb.runcmd(['cryptsetup', 'luksFormat', dev, key_file]) diff --git a/vmdb/plugins/mount_plugin.py b/vmdb/plugins/mount_plugin.py index 6baf046..f3c736e 100644 --- a/vmdb/plugins/mount_plugin.py +++ b/vmdb/plugins/mount_plugin.py @@ -58,7 +58,7 @@ class MountStepRunner(vmdb.StepRunnerInterface): raise Exception('cannot find tag {}'.format(mount_on)) mount_point = os.path.join( - state.tags.get_mount_point(mount_on), './' + dirname) + state.tags.get_builder_mount_point(mount_on), './' + dirname) if not os.path.exists(mount_point): os.makedirs(mount_point) @@ -74,7 +74,7 @@ class MountStepRunner(vmdb.StepRunnerInterface): def unmount_rootfs(self, step, settings, state): tag = step['mount'] - mount_point = state.tags.get_mount_point(tag) + mount_point = state.tags.get_builder_mount_point(tag) if mount_point is None: return diff --git a/vmdb/plugins/qemudebootstrap_plugin.py b/vmdb/plugins/qemudebootstrap_plugin.py index 2fa7c00..75755ac 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.tags.get_mount_point(tag) + target = state.tags.get_builder_mount_point(tag) mirror = step['mirror'] keyring = step.get('keyring', None) variant = step.get('variant', '-') @@ -65,5 +65,5 @@ class QemuDebootstrapStepRunner(vmdb.StepRunnerInterface): def run_even_if_skipped(self, step, settings, state): tag = step['target'] - target = state.tags.get_mount_point(tag) + target = state.tags.get_builder_mount_point(tag) vmdb.runcmd_chroot(target, ['apt-get', 'update']) diff --git a/vmdb/plugins/rootfs_cache_plugin.py b/vmdb/plugins/rootfs_cache_plugin.py index edfb3d4..2db907f 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.tags.get_mount_point(fs_tag) + rootdir = state.tags.get_builder_mount_point(fs_tag) tar_path = settings['rootfs-tarball'] opts = step.get('options', '--one-file-system').split() if not tar_path: @@ -54,7 +54,7 @@ class MakeCacheStepRunner(vmdb.StepRunnerInterface): for tag in tags.get_tags(): vmdb.progress( 'tag {} mounted {} cached {}'.format( - tag, tags.get_mount_point(tag), tags.is_cached(tag))) + tag, tags.get_builder_mount_point(tag), tags.is_cached(tag))) vmdb.progress('caching rootdir {}'.format(rootdir)) vmdb.progress('caching relative {}'.format(dirs)) @@ -64,7 +64,7 @@ class MakeCacheStepRunner(vmdb.StepRunnerInterface): def _find_cacheable_mount_points(self, tags, rootdir): return list(sorted( - self._make_relative(rootdir, tags.get_mount_point(tag)) + self._make_relative(rootdir, tags.get_builder_mount_point(tag)) for tag in tags.get_tags() if tags.is_cached(tag) )) @@ -83,7 +83,7 @@ class UnpackCacheStepRunner(vmdb.StepRunnerInterface): def run(self, step, settings, state): fs_tag = step['unpack-rootfs'] - rootdir = state.tags.get_mount_point(fs_tag) + rootdir = state.tags.get_builder_mount_point(fs_tag) tar_path = settings['rootfs-tarball'] if not tar_path: raise Exception('--rootfs-tarball MUST be set') diff --git a/vmdb/plugins/virtuals_plugin.py b/vmdb/plugins/virtuals_plugin.py index 092c505..10ae586 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.tags.get_mount_point(fstag) + mount_point = state.tags.get_builder_mount_point(fstag) self.mount_virtuals(mount_point, state) def teardown(self, step, settings, state): diff --git a/vmdb/tags.py b/vmdb/tags.py index 27b866d..d774ec5 100644 --- a/vmdb/tags.py +++ b/vmdb/tags.py @@ -38,7 +38,7 @@ class Tags: item = self._get(tag) return item['dev'] - def get_mount_point(self, tag): + def get_builder_mount_point(self, tag): item = self._get(tag) return item['builder_mount_point'] diff --git a/vmdb/tags_tests.py b/vmdb/tags_tests.py index cb4a1dd..48d0b2a 100644 --- a/vmdb/tags_tests.py +++ b/vmdb/tags_tests.py @@ -49,7 +49,7 @@ class TagsTests(unittest.TestCase): def test_get_mount_point_raises_error_for_unknown_tag(self): tags = vmdb.Tags() with self.assertRaises(vmdb.UnknownTag): - tags.get_mount_point('does-not-exist') + tags.get_builder_mount_point('does-not-exist') def test_raises_error_for_reused_tag(self): tags = vmdb.Tags() @@ -63,7 +63,7 @@ class TagsTests(unittest.TestCase): tags.set_dev('first', '/dev/foo') self.assertEqual(tags.get_tags(), ['first']) self.assertEqual(tags.get_dev('first'), '/dev/foo') - self.assertEqual(tags.get_mount_point('first'), None) + self.assertEqual(tags.get_builder_mount_point('first'), None) def test_adds_mount_point(self): tags = vmdb.Tags() @@ -71,7 +71,7 @@ class TagsTests(unittest.TestCase): tags.set_builder_mount_point('first', '/mnt/foo') self.assertEqual(tags.get_tags(), ['first']) self.assertEqual(tags.get_dev('first'), None) - self.assertEqual(tags.get_mount_point('first'), '/mnt/foo') + self.assertEqual(tags.get_builder_mount_point('first'), '/mnt/foo') def test_mount_point_is_uncached_by_default(self): tags = vmdb.Tags() -- cgit v1.2.1