mirror of
https://github.com/containers/podman-compose.git
synced 2024-11-23 00:13:25 +01:00
Support for starting/stopping/restarting all services
Reverse services when stopping or restarting
This commit is contained in:
parent
af1697e9bf
commit
3e940579d9
@ -1544,11 +1544,15 @@ def compose_exec(compose, args):
|
||||
def transfer_service_status(compose, args, action):
|
||||
# TODO: handle dependencies, handle creations
|
||||
container_names_by_service = compose.container_names_by_service
|
||||
if not args.services:
|
||||
args.services = container_names_by_service.keys()
|
||||
targets = []
|
||||
for service in args.services:
|
||||
if service not in container_names_by_service:
|
||||
raise ValueError("unknown service: " + service)
|
||||
targets.extend(container_names_by_service[service])
|
||||
if action in ['stop', 'restart']:
|
||||
targets = list(reversed(targets))
|
||||
podman_args=[]
|
||||
timeout=getattr(args, 'timeout', None)
|
||||
if timeout is not None:
|
||||
@ -1692,11 +1696,6 @@ def compose_parse_timeout(parser):
|
||||
help="Specify a shutdown timeout in seconds. ",
|
||||
type=int, default=10)
|
||||
|
||||
@cmd_parse(podman_compose, ['start', 'stop', 'restart'])
|
||||
def compose_parse_services(parser):
|
||||
parser.add_argument('services', metavar='services', nargs='+',
|
||||
help='affected services')
|
||||
|
||||
@cmd_parse(podman_compose, ['logs'])
|
||||
def compose_logs_parse(parser):
|
||||
parser.add_argument("-f", "--follow", action='store_true',
|
||||
@ -1738,7 +1737,7 @@ def compose_build_parse(parser):
|
||||
parser.add_argument("--no-cache",
|
||||
help="Do not use cache when building the image.", action='store_true')
|
||||
|
||||
@cmd_parse(podman_compose, ['build', 'up', 'down'])
|
||||
@cmd_parse(podman_compose, ['build', 'up', 'down', 'start', 'stop', 'restart'])
|
||||
def compose_build_parse(parser):
|
||||
parser.add_argument('services', metavar='services', nargs='*',default=None,
|
||||
help='affected services')
|
||||
|
Loading…
Reference in New Issue
Block a user