mirror of
https://github.com/containers/podman-compose.git
synced 2025-01-24 14:58:50 +01:00
#28: split string command
This commit is contained in:
parent
c3e67bb332
commit
ed3c033be4
@ -38,6 +38,8 @@ if PY3:
|
|||||||
is_str = lambda s: isinstance(s, basestring)
|
is_str = lambda s: isinstance(s, basestring)
|
||||||
is_dict = lambda d: isinstance(d, dict)
|
is_dict = lambda d: isinstance(d, dict)
|
||||||
is_list = lambda l: not is_str(l) and not is_dict(l) and hasattr(l, "__iter__")
|
is_list = lambda l: not is_str(l) and not is_dict(l) and hasattr(l, "__iter__")
|
||||||
|
# identity filter
|
||||||
|
filteri = lambda a: filter(lambda i:i, a)
|
||||||
|
|
||||||
def try_int(i, fallback=None):
|
def try_int(i, fallback=None):
|
||||||
try:
|
try:
|
||||||
@ -87,7 +89,7 @@ def parse_short_mount(mount_str, basedir):
|
|||||||
# Named volume
|
# Named volume
|
||||||
# - datavolume:/var/lib/mysql
|
# - datavolume:/var/lib/mysql
|
||||||
mount_type = "volume"
|
mount_type = "volume"
|
||||||
mount_opts = filter(lambda i:i, (mount_opt or '').split(','))
|
mount_opts = filteri((mount_opt or '').split(','))
|
||||||
for opt in mount_opts:
|
for opt in mount_opts:
|
||||||
if opt=='ro': mount_opt_dict["read_only"]=True
|
if opt=='ro': mount_opt_dict["read_only"]=True
|
||||||
elif opt=='rw': mount_opt_dict["read_only"]=False
|
elif opt=='rw': mount_opt_dict["read_only"]=False
|
||||||
@ -528,7 +530,7 @@ def container_to_args(compose, cnt, detached=True):
|
|||||||
command = cnt.get('command')
|
command = cnt.get('command')
|
||||||
if command is not None:
|
if command is not None:
|
||||||
if is_str(command):
|
if is_str(command):
|
||||||
podman_args.extend([command])
|
podman_args.extend(command.split())
|
||||||
else:
|
else:
|
||||||
podman_args.extend(command)
|
podman_args.extend(command)
|
||||||
return podman_args
|
return podman_args
|
||||||
|
Loading…
Reference in New Issue
Block a user