#355: fix dry run

This commit is contained in:
Muayyad alsadi 2021-11-13 13:08:32 +02:00
parent 117b7fbb9e
commit ae3deb19dc

View File

@ -81,8 +81,8 @@ def ver_as_list(a):
return [try_int(i, i) for i in num_split_re.findall(a)] return [try_int(i, i) for i in num_split_re.findall(a)]
def strverscmp_lt(a, b): def strverscmp_lt(a, b):
a_ls = ver_as_list(a) a_ls = ver_as_list(a or '')
b_ls = ver_as_list(b) b_ls = ver_as_list(b or '')
return a_ls < b_ls return a_ls < b_ls
def parse_short_mount(mount_str, basedir): def parse_short_mount(mount_str, basedir):
@ -978,6 +978,7 @@ def resolve_extends(services, service_names, dotenv_dict):
class PodmanCompose: class PodmanCompose:
def __init__(self): def __init__(self):
self.podman_version = None
self.exit_code = None self.exit_code = None
self.commands = {} self.commands = {}
self.global_args = None self.global_args = None
@ -1376,7 +1377,7 @@ def create_pods(compose, args):
"--name={}".format(pod["name"]), "--name={}".format(pod["name"]),
"--share", "net", "--share", "net",
] ]
if not strverscmp_lt(compose.podman_version, "3.4.0"): if compose.podman_version and not strverscmp_lt(compose.podman_version, "3.4.0"):
podman_args.append("--infra-name={}_infra".format(pod["name"])) podman_args.append("--infra-name={}_infra".format(pod["name"]))
ports = pod.get("ports", None) or [] ports = pod.get("ports", None) or []
if isinstance(ports, str): if isinstance(ports, str):