mirror of
https://github.com/containers/podman-compose.git
synced 2024-11-25 17:33:50 +01:00
add no-normalize flag
Signed-off-by: Evedel <svbiriukov@gmail.com>
This commit is contained in:
parent
57c527c2c9
commit
bc9168b039
@ -1627,7 +1627,8 @@ class PodmanCompose:
|
||||
compose.get("services", {}), set(args.profile)
|
||||
)
|
||||
compose["services"] = resolved_services
|
||||
compose = normalize_final(compose, self.dirname)
|
||||
if not args.no_normalize:
|
||||
compose = normalize_final(compose, self.dirname)
|
||||
self.merged_yaml = yaml.safe_dump(compose)
|
||||
merged_json_b = json.dumps(compose, separators=(",", ":")).encode("utf-8")
|
||||
self.yaml_hash = hashlib.sha256(merged_json_b).hexdigest()
|
||||
@ -3082,6 +3083,9 @@ def compose_build_parse(parser):
|
||||
|
||||
@cmd_parse(podman_compose, "config")
|
||||
def compose_config_parse(parser):
|
||||
parser.add_argument(
|
||||
"--no-normalize", help="Don't normalize compose model.", action="store_true"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--services", help="Print the service names, one per line.", action="store_true"
|
||||
)
|
||||
|
@ -138,7 +138,9 @@ def test__parse_compose_file_when_multiple_composes() -> None:
|
||||
if actual_compose != expected_result:
|
||||
print("compose: ", test_input)
|
||||
print("override: ", test_override)
|
||||
print("result: ", expected_result)
|
||||
print("expected: ", expected_result)
|
||||
print("actual: ", actual_compose)
|
||||
|
||||
compose_expected = expected_result
|
||||
|
||||
assert compose_expected == actual_compose
|
||||
@ -151,6 +153,7 @@ def set_args(podman_compose: PodmanCompose, file_names: list[str]) -> None:
|
||||
podman_compose.global_args.env_file = None
|
||||
podman_compose.global_args.profile = []
|
||||
podman_compose.global_args.in_pod = True
|
||||
podman_compose.global_args.no_normalize = True
|
||||
|
||||
|
||||
def dump_yaml(compose: dict, name: str) -> None:
|
||||
|
@ -107,6 +107,7 @@ def set_args(podman_compose: PodmanCompose, file_names: list[str]) -> None:
|
||||
podman_compose.global_args.env_file = None
|
||||
podman_compose.global_args.profile = []
|
||||
podman_compose.global_args.in_pod = True
|
||||
podman_compose.global_args.no_normalize = None
|
||||
|
||||
|
||||
def dump_yaml(compose: dict, name: str) -> None:
|
||||
|
@ -146,7 +146,7 @@ def test__parse_compose_file_when_single_compose() -> None:
|
||||
dump_yaml(compose_test, "test-compose.yaml")
|
||||
|
||||
podman_compose = PodmanCompose()
|
||||
set_args(podman_compose, ["test-compose.yaml"])
|
||||
set_args(podman_compose, ["test-compose.yaml"], no_normalize=None)
|
||||
|
||||
podman_compose._parse_compose_file()
|
||||
|
||||
@ -271,7 +271,11 @@ def test__parse_compose_file_when_multiple_composes() -> None:
|
||||
dump_yaml(compose_test_2, "test-compose-2.yaml")
|
||||
|
||||
podman_compose = PodmanCompose()
|
||||
set_args(podman_compose, ["test-compose-1.yaml", "test-compose-2.yaml"])
|
||||
set_args(
|
||||
podman_compose,
|
||||
["test-compose-1.yaml", "test-compose-2.yaml"],
|
||||
no_normalize=None,
|
||||
)
|
||||
|
||||
podman_compose._parse_compose_file()
|
||||
|
||||
@ -288,13 +292,16 @@ def test__parse_compose_file_when_multiple_composes() -> None:
|
||||
assert compose_expected == actual_compose
|
||||
|
||||
|
||||
def set_args(podman_compose: PodmanCompose, file_names: list[str]) -> None:
|
||||
def set_args(
|
||||
podman_compose: PodmanCompose, file_names: list[str], no_normalize: bool
|
||||
) -> None:
|
||||
podman_compose.global_args = argparse.Namespace()
|
||||
podman_compose.global_args.file = file_names
|
||||
podman_compose.global_args.project_name = None
|
||||
podman_compose.global_args.env_file = None
|
||||
podman_compose.global_args.profile = []
|
||||
podman_compose.global_args.in_pod = True
|
||||
podman_compose.global_args.no_normalize = no_normalize
|
||||
|
||||
|
||||
def dump_yaml(compose: dict, name: str) -> None:
|
||||
|
Loading…
Reference in New Issue
Block a user