diff options
author | Lars Wirzenius <liw@liw.fi> | 2017-03-29 13:05:59 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2017-03-29 13:05:59 +0300 |
commit | 981dda39aa96bbc898b2b7bf04405f515141f664 (patch) | |
tree | 186fc183e0edc2d088ea16172a0450c907ece786 | |
parent | 774909bc40c88b4842be86e71b2810c45edf2270 (diff) | |
download | vmdb2-981dda39aa96bbc898b2b7bf04405f515141f664.tar.gz |
Rename step_spec to just step, for clarity
-rw-r--r-- | vmdb/plugins/chroot_plugin.py | 6 | ||||
-rw-r--r-- | vmdb/plugins/debootstrap_plugin.py | 8 | ||||
-rw-r--r-- | vmdb/plugins/echo_plugin.py | 10 | ||||
-rw-r--r-- | vmdb/plugins/error_plugin.py | 12 | ||||
-rw-r--r-- | vmdb/plugins/kernel_plugin.py | 6 | ||||
-rw-r--r-- | vmdb/plugins/mkfs_plugin.py | 6 | ||||
-rw-r--r-- | vmdb/plugins/mkimg_plugin.py | 6 | ||||
-rw-r--r-- | vmdb/plugins/mount_plugin.py | 12 | ||||
-rw-r--r-- | vmdb/plugins/partition_plugin.py | 25 |
9 files changed, 45 insertions, 46 deletions
diff --git a/vmdb/plugins/chroot_plugin.py b/vmdb/plugins/chroot_plugin.py index c8eac68..0252b95 100644 --- a/vmdb/plugins/chroot_plugin.py +++ b/vmdb/plugins/chroot_plugin.py @@ -36,9 +36,9 @@ class ChrootStepRunner(vmdb.StepRunnerInterface): def get_required_keys(self): return ['chroot', 'shell'] - def run(self, step_spec, settings, state): - fs_tag = step_spec['chroot'] - shell= step_spec['shell'] + def run(self, step, settings, state): + fs_tag = step['chroot'] + shell= step['shell'] mount_point = state.mounts[fs_tag] diff --git a/vmdb/plugins/debootstrap_plugin.py b/vmdb/plugins/debootstrap_plugin.py index d887b7f..2d0f988 100644 --- a/vmdb/plugins/debootstrap_plugin.py +++ b/vmdb/plugins/debootstrap_plugin.py @@ -36,11 +36,11 @@ class DebootstrapStepRunner(vmdb.StepRunnerInterface): def get_required_keys(self): return ['debootstrap', 'target', 'mirror'] - def run(self, step_spec, settings, state): - suite = step_spec['debootstrap'] - tag = step_spec['target'] + def run(self, step, settings, state): + suite = step['debootstrap'] + tag = step['target'] target = state.mounts[tag] - mirror = step_spec['mirror'] + mirror = step['mirror'] if not (suite and tag and target and mirror): raise Exception('missing arg for debootstrap step') sys.stdout.write( diff --git a/vmdb/plugins/echo_plugin.py b/vmdb/plugins/echo_plugin.py index 376df1b..b3eb4d4 100644 --- a/vmdb/plugins/echo_plugin.py +++ b/vmdb/plugins/echo_plugin.py @@ -36,12 +36,12 @@ class EchoStepRunner(vmdb.StepRunnerInterface): def get_required_keys(self): return ['echo'] - def run(self, step_spec, settings, state): - text = step_spec['echo'] + def run(self, step, settings, state): + text = step['echo'] sys.stdout.write('{}\n'.format(text)) - def teardown(self, step_spec, settings, state): - if 'teardown' in step_spec: - text = step_spec['teardown'] + def teardown(self, step, settings, state): + if 'teardown' in step: + text = step['teardown'] sys.stdout.write('{}\n'.format(text)) logging.info('%s', text) diff --git a/vmdb/plugins/error_plugin.py b/vmdb/plugins/error_plugin.py index 92f1b36..b417cc9 100644 --- a/vmdb/plugins/error_plugin.py +++ b/vmdb/plugins/error_plugin.py @@ -36,11 +36,11 @@ class ErrorStepRunner(vmdb.StepRunnerInterface): def get_required_keys(self): return ['error', 'teardown'] - def run(self, step_spec, settings, state): - sys.stdout.write('ERROR: {}\n'.format(step_spec['error'])) - logging.error('%s', step_spec['error']) + def run(self, step, settings, state): + sys.stdout.write('ERROR: {}\n'.format(step['error'])) + logging.error('%s', step['error']) raise vmdb.StepError('an error occurred') - def teardown(self, step_spec, settings, state): - sys.stdout.write('ERROR: {}\n'.format(step_spec['teardown'])) - logging.error('error cleanup: %s', step_spec['teardown']) + def teardown(self, step, settings, state): + sys.stdout.write('ERROR: {}\n'.format(step['teardown'])) + logging.error('error cleanup: %s', step['teardown']) diff --git a/vmdb/plugins/kernel_plugin.py b/vmdb/plugins/kernel_plugin.py index 52fc33b..0a46d21 100644 --- a/vmdb/plugins/kernel_plugin.py +++ b/vmdb/plugins/kernel_plugin.py @@ -36,9 +36,9 @@ class KernelStepRunner(vmdb.StepRunnerInterface): def get_required_keys(self): return ['kernel', 'fs-tag'] - def run(self, step_spec, settings, state): - package = step_spec['kernel'] - fstag = step_spec['fs-tag'] + def run(self, step, settings, state): + package = step['kernel'] + fstag = step['fs-tag'] mount_point = state.mounts[fstag] sys.stdout.write( 'Install {} to filesystem at {} ({})\n'.format( diff --git a/vmdb/plugins/mkfs_plugin.py b/vmdb/plugins/mkfs_plugin.py index 1ea3090..5cd3891 100644 --- a/vmdb/plugins/mkfs_plugin.py +++ b/vmdb/plugins/mkfs_plugin.py @@ -36,9 +36,9 @@ class MkfsStepRunner(vmdb.StepRunnerInterface): def get_required_keys(self): return ['mkfs', 'partition'] - def run(self, step_spec, settings, state): - fstype = step_spec['mkfs'] - part_tag = step_spec['partition'] + def run(self, step, settings, state): + fstype = step['mkfs'] + part_tag = step['partition'] device = state.parts[part_tag] sys.stdout.write( 'Creating {} filesystem on {}\n'.format(fstype, device)) diff --git a/vmdb/plugins/mkimg_plugin.py b/vmdb/plugins/mkimg_plugin.py index 274187a..6b7ba9e 100644 --- a/vmdb/plugins/mkimg_plugin.py +++ b/vmdb/plugins/mkimg_plugin.py @@ -40,9 +40,9 @@ class MkimgStepRunner(vmdb.StepRunnerInterface): def get_required_keys(self): return ['mkimg'] - def run(self, step_spec, settings, state): - filename = step_spec['mkimg'] - size = step_spec['size'] + def run(self, step, settings, state): + filename = step['mkimg'] + size = step['size'] sys.stdout.write( 'Creating image file {} (size {})\n'.format(filename, size)) cliapp.runcmd( diff --git a/vmdb/plugins/mount_plugin.py b/vmdb/plugins/mount_plugin.py index a872dc7..3344be9 100644 --- a/vmdb/plugins/mount_plugin.py +++ b/vmdb/plugins/mount_plugin.py @@ -38,12 +38,12 @@ class MountStepRunner(vmdb.StepRunnerInterface): def get_required_keys(self): return ['mount', 'fs-tag'] - def run(self, step_spec, settings, state): + def run(self, step, settings, state): if not hasattr(state, 'mounts'): state.mounts = {} - part_tag = step_spec['mount'] - fs_tag = step_spec['fs-tag'] + part_tag = step['mount'] + fs_tag = step['fs-tag'] if fs_tag in state.mounts: raise Exception('fs-tag {} already used'.format(fs_tag)) @@ -55,10 +55,10 @@ class MountStepRunner(vmdb.StepRunnerInterface): cliapp.runcmd(['mount', device, mount_point]) state.mounts[fs_tag] = mount_point - def teardown(self, step_spec, settings, state): - part_tag = step_spec['mount'] + def teardown(self, step, settings, state): + part_tag = step['mount'] device = state.parts[part_tag] - fs_tag = step_spec['fs-tag'] + fs_tag = step['fs-tag'] mount_point = state.mounts[fs_tag] sys.stdout.write( diff --git a/vmdb/plugins/partition_plugin.py b/vmdb/plugins/partition_plugin.py index b2412f9..f64806c 100644 --- a/vmdb/plugins/partition_plugin.py +++ b/vmdb/plugins/partition_plugin.py @@ -38,9 +38,9 @@ class MklabelStepRunner(vmdb.StepRunnerInterface): def get_required_keys(self): return ['mklabel'] - def run(self, step_spec, settings, state): - label_type = step_spec['mklabel'] - device = step_spec['device'] + def run(self, step, settings, state): + label_type = step['mklabel'] + device = step['device'] sys.stdout.write( 'Creating partition table ({}) on {}\n'.format(label_type, device)) cliapp.runcmd(['parted', device, 'mklabel', label_type], stderr=None) @@ -52,12 +52,12 @@ class MkpartStepRunner(vmdb.StepRunnerInterface): def get_required_keys(self): return ['mkpart'] - def run(self, step_spec, settings, state): - part_type = step_spec['mkpart'] - device = step_spec['device'] - start = step_spec['start'] - end = step_spec['end'] - part_tag = step_spec['part-tag'] + def run(self, step, settings, state): + part_type = step['mkpart'] + device = step['device'] + start = step['start'] + end = step['end'] + part_tag = step['part-tag'] sys.stdout.write( 'Creating partition ({}) on {} ({} to {})\n'.format( @@ -67,18 +67,17 @@ class MkpartStepRunner(vmdb.StepRunnerInterface): cliapp.runcmd(['kpartx', '-d', device]) output = cliapp.runcmd(['kpartx', '-asv', device]) for line in output.splitlines(): - print 'kpartx:', line words = line.split() if words[0] == 'add': name = words[2] device_file = '/dev/mapper/{}'.format(name) - + parts = getattr(state, 'parts', {}) parts[part_tag] = device_file state.parts = parts - def teardown(self, step_spec, settings, state): - device = step_spec['device'] + def teardown(self, step, settings, state): + device = step['device'] sys.stdout.write( 'Undoing loopback devices for partitions on {}\n'.format(device)) cliapp.runcmd(['kpartx', '-d', device]) |