diff options
| author | Chad Smith <chad.smith@canonical.com> | 2018-02-02 11:11:36 -0700 |
|---|---|---|
| committer | Chad Smith <chad.smith@canonical.com> | 2018-02-02 11:11:36 -0700 |
| commit | 78013bc65030421699b5feb66bc8b7a205abfbc0 (patch) | |
| tree | 2ebf7111129f4aaf8a833ba6d226d4513ed59388 /tests/cloud_tests/util.py | |
| parent | 192261fe38a32edbd1f605ba25bbb6f4822a0720 (diff) | |
| parent | f7deaf15acf382d62554e2b1d70daa9a9109d542 (diff) | |
| download | vyos-cloud-init-78013bc65030421699b5feb66bc8b7a205abfbc0.tar.gz vyos-cloud-init-78013bc65030421699b5feb66bc8b7a205abfbc0.zip | |
merge from master at 17.2-30-gf7deaf15
Diffstat (limited to 'tests/cloud_tests/util.py')
| -rw-r--r-- | tests/cloud_tests/util.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/tests/cloud_tests/util.py b/tests/cloud_tests/util.py index c5cd6974..6ff285e7 100644 --- a/tests/cloud_tests/util.py +++ b/tests/cloud_tests/util.py @@ -262,7 +262,7 @@ def shell_safe(cmd): out = subprocess.check_output( ["getopt", "--shell", "sh", "--options", "", "--", "--"] + list(cmd)) # out contains ' -- <data>\n'. drop the ' -- ' and the '\n' - return out[4:-1].decode() + return out.decode()[4:-1] def shell_pack(cmd): @@ -321,9 +321,9 @@ class TargetBase(object): rcs = (0,) if description: - LOG.debug('Executing "%s"', description) + LOG.debug('executing "%s"', description) else: - LOG.debug("Executing command: %s", shell_quote(command)) + LOG.debug("executing command: %s", shell_quote(command)) out, err, rc = self._execute(command=command, stdin=stdin, env=env) @@ -447,6 +447,19 @@ class InTargetExecuteError(c_util.ProcessExecutionError): reason=reason) +class PlatformError(IOError): + """Error type for platform errors.""" + + default_desc = 'unexpected error in platform.' + + def __init__(self, operation, description=None): + """Init error and parent error class.""" + description = description if description else self.default_desc + + message = '%s: %s' % (operation, description) + IOError.__init__(self, message) + + class TempDir(object): """Configurable temporary directory like tempfile.TemporaryDirectory.""" |
