mirror of
https://github.com/containers/podman-compose.git
synced 2025-04-17 05:58:36 +02:00
Don't raise exception on inexistent services in 'down' command
When running 'podman-compose down <service>', if service is not part of the compose, a KeyError exception is raised in function 'get_excluded'. By only allowing evaluation of services that exist in the compose provides a cleaner and gentler exit for this case. Signed-off-by: Rafael Guterres Jeffman <rjeffman@redhat.com>
This commit is contained in:
parent
7c61f24467
commit
d4760712b7
1
newsfragments/compose_down_inexistent_service.bugfix
Normal file
1
newsfragments/compose_down_inexistent_service.bugfix
Normal file
@ -0,0 +1 @@
|
||||
- Fixed KeyError in case podman-compose down was called with an inexistent service
|
@ -2648,7 +2648,8 @@ def get_excluded(compose, args):
|
||||
if args.services:
|
||||
excluded = set(compose.services)
|
||||
for service in args.services:
|
||||
if not args.no_deps:
|
||||
# we need 'getattr' as compose_down_parse dose not configure 'no_deps'
|
||||
if service in compose.services and not getattr(args, "no_deps", False):
|
||||
excluded -= set(x.name for x in compose.services[service]["_deps"])
|
||||
excluded.discard(service)
|
||||
log.debug("** excluding: %s", excluded)
|
||||
|
Loading…
Reference in New Issue
Block a user