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() for name, opts in self.__volumes_defs.items()
} }
@property def exec_compose(
def compose_cmd(self) -> CommandArgs: self,
return CommandArgs( command: CommandArgs,
PODMAN_COMPOSE_EXEC check: bool = True,
+ [f"--project-name=self.project_name"] ) -> CompletedProcess:
+ [f"--file={file}" for file in self.compose_files] 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]): def exec(given_args: Sequence[str]):
args = parse_args(args=given_args) args = parse_args(args=given_args)
compose = ComposeFile(*args.file, project_name=args.project_name) compose = ComposeFile(*args.file, project_name=args.project_name)
print(compose.compose_cmd)
def cli(args: Sequence[str]): def cli(args: Sequence[str]):

Loading…
Cancel
Save