FIXES #409: detect changes and recreate

This commit is contained in:
Muayyad alsadi 2022-03-16 15:27:30 +03:00
parent 529391963d
commit 8a72321720

View File

@ -1920,11 +1920,21 @@ def compose_up(compose, args):
build_args = argparse.Namespace(if_not_exists=(not args.build), **args.__dict__) build_args = argparse.Namespace(if_not_exists=(not args.build), **args.__dict__)
compose.commands["build"](compose, build_args) compose.commands["build"](compose, build_args)
hashes = compose.podman.output([], "ps", [ hashes = (
compose.podman.output(
[],
"ps",
[
"--filter", "--filter",
f"label=io.podman.compose.project={proj_name}", f"label=io.podman.compose.project={proj_name}",
"-a", "--format", "{{ index .Labels \"io.podman.compose.config-hash\"}}" "-a",
]).decode('utf-8').splitlines() "--format",
'{{ index .Labels "io.podman.compose.config-hash"}}',
],
)
.decode("utf-8")
.splitlines()
)
diff_hashes = [i for i in hashes if i and i != compose.yaml_hash] 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 or len(diff_hashes):
log("recreating: ...") log("recreating: ...")