ComposeFile.exec_compose: Rewrite to execute command directly

main
Felix Stupp 2 years ago
parent 72fc6002c1
commit 29f56d512c
Signed by: zocker
GPG Key ID: 93E1BD26F6B02FB7

@ -284,12 +284,18 @@ class ComposeFile:
for name, opts in self.__volumes_defs.items()
}
@property
def compose_cmd(self) -> CommandArgs:
return CommandArgs(
PODMAN_COMPOSE_EXEC
+ [f"--project-name=self.project_name"]
+ [f"--file={file}" for file in self.compose_files]
def exec_compose(
self,
command: CommandArgs,
check: bool = True,
) -> CompletedProcess:
return self.podman.exec_compose(
command=combine_cmds(
[f"--project-name=self.project_name"],
[f"--file={file}" for file in self.compose_files],
command,
),
check=check,
)
@ -383,7 +389,6 @@ def parse_args(args: Sequence[str]) -> argparse.Namespace:
def exec(given_args: Sequence[str]):
args = parse_args(args=given_args)
compose = ComposeFile(*args.file, project_name=args.project_name)
print(compose.compose_cmd)
def cli(args: Sequence[str]):

Loading…
Cancel
Save