Fix KeyErrors encountered with extended services

Docker compose file used:
https://github.com/wikimedia/mediawiki-extensions-Wikibase/blob/master/view/lib/wikibase-tainted-ref/docker-compose.yml
This commit is contained in:
Marius Hoch 2019-10-25 09:49:51 +02:00 committed by Muayyad Alsadi
parent 29d4cdc9ab
commit 7ebbe2efc6

View File

@ -600,6 +600,7 @@ def flat_deps(services, with_extends=False):
"""
for name, srv in services.items():
deps = set()
srv["_deps"] = deps
if with_extends:
ext = srv.get("extends", {}).get("service", None)
if ext:
@ -609,7 +610,6 @@ def flat_deps(services, with_extends=False):
# parse link to get service name and remove alias
deps.update([(c.split(":")[0] if ":" in c else c)
for c in srv.get("links", [])])
srv["_deps"] = deps
for name, srv in services.items():
rec_deps(services, name)
@ -714,7 +714,10 @@ def resolve_extends(services, service_names, dotenv_dict):
else:
from_service = services.get(from_service_name, {}).copy()
del from_service["_deps"]
del from_service["extends"]
try:
del from_service["extends"]
except KeyError:
pass
new_service = rec_merge({}, from_service, service)
services[name] = new_service