mirror of
https://github.com/containers/podman-compose.git
synced 2025-08-18 01:20:01 +02:00
Merge pull request #1184 from schnell18/main
Fix service_healthy condition enforcing
This commit is contained in:
@@ -2815,6 +2815,18 @@ async def check_dep_conditions(compose: PodmanCompose, deps: set) -> None:
|
||||
deps_cd = []
|
||||
for d in deps:
|
||||
if d.condition == condition:
|
||||
if (
|
||||
d.condition
|
||||
in (ServiceDependencyCondition.HEALTHY, ServiceDependencyCondition.UNHEALTHY)
|
||||
) and strverscmp_lt(compose.podman_version, "4.6.0"):
|
||||
log.warning(
|
||||
"Ignored %s condition check due to podman %s doesn't support %s!",
|
||||
d.name,
|
||||
compose.podman_version,
|
||||
condition.value,
|
||||
)
|
||||
continue
|
||||
|
||||
deps_cd.extend(compose.container_names_by_service[d.name])
|
||||
|
||||
if deps_cd:
|
||||
@@ -2891,28 +2903,25 @@ async def compose_up(compose: PodmanCompose, args):
|
||||
.splitlines()
|
||||
)
|
||||
diff_hashes = [i for i in hashes if i and i != compose.yaml_hash]
|
||||
if args.force_recreate or len(diff_hashes):
|
||||
if (args.force_recreate and len(hashes) > 0) or len(diff_hashes):
|
||||
log.info("recreating: ...")
|
||||
down_args = argparse.Namespace(**dict(args.__dict__, volumes=False, rmi=None))
|
||||
await compose.commands["down"](compose, down_args)
|
||||
log.info("recreating: done\n\n")
|
||||
# args.no_recreate disables check for changes (which is not implemented)
|
||||
|
||||
podman_command = "run" if args.detach and not args.no_start else "create"
|
||||
|
||||
await create_pods(compose, args)
|
||||
for cnt in compose.containers:
|
||||
if cnt["_service"] in excluded:
|
||||
log.debug("** skipping: %s", cnt["name"])
|
||||
continue
|
||||
podman_args = await container_to_args(
|
||||
compose, cnt, detached=args.detach, no_deps=args.no_deps
|
||||
)
|
||||
subproc = await compose.podman.run([], podman_command, podman_args)
|
||||
if podman_command == "run" and subproc is not None:
|
||||
podman_args = await container_to_args(compose, cnt, detached=False, no_deps=args.no_deps)
|
||||
subproc = await compose.podman.run([], "create", podman_args)
|
||||
if not args.no_start and args.detach and subproc is not None:
|
||||
await run_container(
|
||||
compose, cnt["name"], deps_from_container(args, cnt), ([], "start", [cnt["name"]])
|
||||
)
|
||||
|
||||
if args.no_start or args.detach or args.dry_run:
|
||||
return
|
||||
# TODO: handle already existing
|
||||
|
Reference in New Issue
Block a user