diff options
-rw-r--r-- | vmdb/__init__.py | 1 | ||||
-rw-r--r-- | vmdb/plugins/luks_plugin.py | 5 | ||||
-rw-r--r-- | vmdb/step_list.py | 7 |
3 files changed, 13 insertions, 0 deletions
diff --git a/vmdb/__init__.py b/vmdb/__init__.py index 63cf1b7..d494e0a 100644 --- a/vmdb/__init__.py +++ b/vmdb/__init__.py @@ -19,6 +19,7 @@ from .version import __version__, __version_info__ from .state import State from .step_list import ( + IsEmptyString, StepRunnerList, StepRunnerInterface, NoMatchingRunner, diff --git a/vmdb/plugins/luks_plugin.py b/vmdb/plugins/luks_plugin.py index 9d48d99..c5e1bef 100644 --- a/vmdb/plugins/luks_plugin.py +++ b/vmdb/plugins/luks_plugin.py @@ -41,6 +41,11 @@ class CryptsetupStepRunner(vmdb.StepRunnerInterface): underlying = step['cryptsetup'] crypt_name = step['tag'] + if not isinstance(underlying, str): + raise vmdb.NotString('cryptsetup', underlying) + if not isinstance(crypt_name, str): + raise vmdb.NotString('cryptsetup: tag', crypt_name) + state.tmp_key_file = None key_file = step.get('key-file') key_cmd = step.get('key-cmd') diff --git a/vmdb/step_list.py b/vmdb/step_list.py index 20e3ec6..468cf35 100644 --- a/vmdb/step_list.py +++ b/vmdb/step_list.py @@ -95,3 +95,10 @@ class NotString(StepError): # pragma: no cover def __init__(self, name, actual): msg = '%s: value must be string, got %r' % (name, actual) super().__init__(msg) + + +class IsEmptyString(StepError): # pragma: no cover + + def __init__(self, name, actual): + msg = '%s: value must not be an empty string, got %r' % (name, actual) + super().__init__(msg) |