ComposeContainer.exec: Rewrite to execute command directly

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

@ -311,21 +311,24 @@ class ComposeContainer:
def depends_on(self) -> Sequence[ComposeContainer]: def depends_on(self) -> Sequence[ComposeContainer]:
return [self.compose.services[name] for name in self.base.get("depends_on", [])] return [self.compose.services[name] for name in self.base.get("depends_on", [])]
def exec_cmd( def exec(
self, self,
command: CommandArgs, command: CommandArgs,
check: bool = True,
workdir: Optional[str] = None, workdir: Optional[str] = None,
) -> CommandArgs: ) -> CompletedProcess:
return combine_cmds( return self.compose.podman.exec_podman(
PODMAN_EXEC, command=combine_cmds(
[ [
"container", "container",
"exec", "exec",
"--interactive=false", "--interactive=false",
None if workdir is None else f"--workdir={workdir}", None if workdir is None else f"--workdir={workdir}",
self.container_name, self.container_name,
], ],
command, command,
),
check=check,
) )

Loading…
Cancel
Save