diff options
author | Neil Williams <neil.williams@linaro.org> | 2018-07-31 13:41:40 +0100 |
---|---|---|
committer | RĂ©mi Duraffort <remi.duraffort@linaro.org> | 2018-09-17 10:57:32 +0000 |
commit | 65ba876cb5bfa07d190097c85fe184e13070b436 (patch) | |
tree | 7340dca96b91ca7b7f20c3232d917500c52f53e6 | |
parent | 79312ea8a318e36dfdeba1051833064f4236c278 (diff) |
Let LXC protocol calls use lists as in base
pre-power and pre-os commands can be lists, allow the
LXC protocols to use the commands as lists.
Signed-off-by: Neil Williams <neil.williams@linaro.org>
-rw-r--r-- | lava_dispatcher/protocols/lxc.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lava_dispatcher/protocols/lxc.py b/lava_dispatcher/protocols/lxc.py index 946d7518e..1efdd85c2 100644 --- a/lava_dispatcher/protocols/lxc.py +++ b/lava_dispatcher/protocols/lxc.py @@ -107,16 +107,23 @@ class LxcProtocol(Protocol): # pylint: disable=too-many-instance-attributes command = action.job.device.pre_os_command if not command: raise JobError("No pre OS command is defined for this device.") - if not action.run_command(command.split(' '), allow_silent=True): - raise InfrastructureError("%s failed" % command) + if not isinstance(command, list): + command = [command] + for cmd in command: + if not self.run_command(cmd.split(' '), allow_silent=True): + raise InfrastructureError("%s failed" % cmd) continue elif 'pre-power-command' in item['request']: action.logger.info("[%s] Running pre-power-command via protocol.", self.name) command = action.job.device.pre_power_command if not command: raise JobError("No pre power command is defined for this device.") - if not action.run_command(command.split(' '), allow_silent=True): - raise InfrastructureError("%s failed" % command) + + if not isinstance(command, list): + command = [command] + for cmd in command: + if not self.run_command(cmd.split(' '), allow_silent=True): + raise InfrastructureError("%s failed" % cmd) continue else: raise JobError("[%s] Unrecognised protocol request: %s" % (self.name, item)) |