This commit is contained in:
Muayyad alsadi 2023-03-29 11:30:24 +03:00
parent bd29ddb3e9
commit b8a7593026

View File

@ -2119,13 +2119,14 @@ def get_volume_names(compose, cnt):
def compose_down(compose, args): def compose_down(compose, args):
excluded = get_excluded(compose, args) excluded = get_excluded(compose, args)
podman_args = [] podman_args = []
timeout = getattr(args, "timeout", None) timeout_global = getattr(args, "timeout", None)
containers = list(reversed(compose.containers)) containers = list(reversed(compose.containers))
for cnt in containers: for cnt in containers:
if cnt["_service"] in excluded: if cnt["_service"] in excluded:
continue continue
podman_stop_args = [*podman_args] podman_stop_args = [*podman_args]
timeout = timeout_global
if timeout is None: if timeout is None:
timeout_str = cnt.get("stop_grace_period", None) or STOP_GRACE_PERIOD timeout_str = cnt.get("stop_grace_period", None) or STOP_GRACE_PERIOD
timeout = str_to_seconds(timeout_str) timeout = str_to_seconds(timeout_str)
@ -2289,9 +2290,10 @@ def transfer_service_status(compose, args, action):
if action in ["stop", "restart"]: if action in ["stop", "restart"]:
targets = list(reversed(targets)) targets = list(reversed(targets))
podman_args = [] podman_args = []
timeout = getattr(args, "timeout", None) timeout_global = getattr(args, "timeout", None)
for target in targets: for target in targets:
if action != "start": if action != "start":
timeout = timeout_global
if timeout is None: if timeout is None:
timeout_str = compose.container_by_name[target].get("stop_grace_period", None) or STOP_GRACE_PERIOD timeout_str = compose.container_by_name[target].get("stop_grace_period", None) or STOP_GRACE_PERIOD
timeout = str_to_seconds(timeout_str) timeout = str_to_seconds(timeout_str)