This commit is contained in:
Muayyad alsadi 2022-07-14 00:59:10 +03:00
parent ccdb98c0e4
commit ae6be272b5

View File

@ -2367,11 +2367,15 @@ def compose_unpause(compose, args):
compose.podman.run([], "unpause", targets)
@cmd_run(podman_compose, "kill", "Kill one or more running containers with a specific signal")
@cmd_run(
podman_compose, "kill", "Kill one or more running containers with a specific signal"
)
def compose_kill(compose, args):
# to ensure that the user did not execute the command by mistake
# to ensure that the user did not execute the command by mistake
if not args.services and not args.all:
print("Error: you must provide at least one service name or use (--all) to kill all services")
print(
"Error: you must provide at least one service name or use (--all) to kill all services"
)
sys.exit()
container_names_by_service = compose.container_names_by_service
@ -2380,7 +2384,7 @@ def compose_kill(compose, args):
if args.signal:
podman_args.extend(["--signal", args.signal])
if args.all is True:
if args.all is True:
services = container_names_by_service.keys()
targets = []
for service in services:
@ -2397,7 +2401,7 @@ def compose_kill(compose, args):
podman_args.append(target)
compose.podman.run([], "kill", podman_args)
###################
# command arguments parsing
###################