Skip to content

Commit d476071

Browse files
committedMar 5, 2025·
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 <[email protected]>
1 parent 7c61f24 commit d476071

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Fixed KeyError in case podman-compose down was called with an inexistent service

‎podman_compose.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -2648,7 +2648,8 @@ def get_excluded(compose, args):
26482648
if args.services:
26492649
excluded = set(compose.services)
26502650
for service in args.services:
2651-
if not args.no_deps:
2651+
# we need 'getattr' as compose_down_parse dose not configure 'no_deps'
Has conversations. Original line has conversations.
2652+
if service in compose.services and not getattr(args, "no_deps", False):
26522653
excluded -= set(x.name for x in compose.services[service]["_deps"])
26532654
excluded.discard(service)
26542655
log.debug("** excluding: %s", excluded)

0 commit comments

Comments
 (0)
Please sign in to comment.