Merge pull request #1117 from rjeffman/no_exception_if_service_is_not_in_compose

Don't raise exception on inexistent services in 'down' command
This commit is contained in:
Povilas Kanapickas 2025-03-05 22:17:10 +02:00 committed by GitHub
commit 04fcc26a79
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View File

@ -0,0 +1 @@
- Fixed KeyError in case podman-compose down was called with an inexistent service

View File

@ -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)