podman_container: command now accepts lists

If the command is in this format ['bash', '-c', 'ls'], it'll now work.
Before only 'bash -c ls' would work.
It's for compatibility with how THT generates container config.

Change-Id: Ib8e943f92b85adcde86d814268a97369b4317ec3
This commit is contained in:
Emilien Macchi 2019-10-08 14:22:58 -04:00
parent d4fdccde40
commit 7fa3b4ebae
1 changed files with 5 additions and 2 deletions

View File

@ -149,7 +149,7 @@ options:
type: path
command:
description:
- Override command of container
- Override command of container. Can be a string or a list.
type: raw
cpu_period:
description:
@ -840,7 +840,10 @@ class PodmanModuleParams:
cmd = getattr(self, func_name)(cmd)
cmd.append(self.params['image'])
if self.params['command']:
cmd += self.params['command'].split()
if isinstance(self.params['command'], list):
cmd += self.params['command']
else:
cmd += self.params['command'].split()
return [to_bytes(i, errors='surrogate_or_strict') for i in cmd]
def start_stop_delete(self):