mirror of
https://github.com/containers/podman-compose.git
synced 2025-08-09 21:57:44 +02:00
Avoid crash when no services are defined
If no services are defined, podman-compose crashes as services variable is None, while the expected behavior might be an error or the same as docker-compose, which will continue the execution of the compose file (eg. creating networks, etc). This commit fixes the crash and allows the program to continue, mimicking docker-compose behavior.
This commit is contained in:
committed by
Muayyad Alsadi
parent
efcbc75f63
commit
796e6a4473
@ -828,6 +828,10 @@ class PodmanCompose:
|
||||
print(" ** merged:\n", json.dumps(compose, indent = 2))
|
||||
ver = compose.get('version')
|
||||
services = compose.get('services')
|
||||
if services is None:
|
||||
services = {}
|
||||
print("WARNING: No services defined")
|
||||
|
||||
# NOTE: maybe add "extends.service" to _deps at this stage
|
||||
flat_deps(services, with_extends=True)
|
||||
service_names = sorted([ (len(srv["_deps"]), name) for name, srv in services.items() ])
|
||||
|
Reference in New Issue
Block a user