diff --git a/newsfragments/compose_down_inexistent_service.bugfix b/newsfragments/compose_down_inexistent_service.bugfix new file mode 100644 index 0000000..80d9c9c --- /dev/null +++ b/newsfragments/compose_down_inexistent_service.bugfix @@ -0,0 +1 @@ +- Fixed KeyError in case podman-compose down was called with an inexistent service diff --git a/podman_compose.py b/podman_compose.py index 77bb999..df1f9ee 100755 --- a/podman_compose.py +++ b/podman_compose.py @@ -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)