forked from extern/podman-compose
ENH: add timeout option to podman-compose down, as in https://docs.docker.com/compose/reference/down/
This commit is contained in:
parent
294f8ee37b
commit
3712b545a9
@ -1161,8 +1161,14 @@ def compose_up(compose, args):
|
||||
|
||||
@cmd_run(podman_compose, 'down', 'tear down entire stack')
|
||||
def compose_down(compose, args):
|
||||
podman_args=[]
|
||||
timeout=getattr(args, 'timeout', None)
|
||||
if timeout is None:
|
||||
timeout = 1
|
||||
podman_args.extend(['-t', "{}".format(timeout)])
|
||||
|
||||
for cnt in compose.containers:
|
||||
compose.podman.run(["stop", "-t=1", cnt["name"]], sleep=0)
|
||||
compose.podman.run(["stop", *podman_args, cnt["name"]], sleep=0)
|
||||
for cnt in compose.containers:
|
||||
compose.podman.run(["rm", cnt["name"]], sleep=0)
|
||||
for pod in compose.pods:
|
||||
@ -1331,7 +1337,7 @@ def compose_run_parse(parser):
|
||||
parser.add_argument('cnt_command', metavar='command', nargs=argparse.REMAINDER,
|
||||
help='command and its arguments')
|
||||
|
||||
@cmd_parse(podman_compose, ['stop', 'restart'])
|
||||
@cmd_parse(podman_compose, ['down', 'stop', 'restart'])
|
||||
def compose_parse_timeout(parser):
|
||||
parser.add_argument("-t", "--timeout",
|
||||
help="Specify a shutdown timeout in seconds. ",
|
||||
|
Loading…
Reference in New Issue
Block a user