Simplify var assignment

This commit is contained in:
ohxodi 2022-04-29 14:35:35 +02:00 committed by Muayyad Alsadi
parent 0057a4bb31
commit 606b9d94c8

View File

@ -190,12 +190,11 @@ def fix_mount_dict(compose, mount_dict, proj_name, srv_name):
elif not name: elif not name:
external = vol.get("external", None) external = vol.get("external", None)
if isinstance(external, dict): if isinstance(external, dict):
ext_name = external.get("name", f"{source}") vol["name"] = external.get("name", f"{source}")
elif external: elif external:
ext_name = f"{source}" vol["name"] = f"{source}"
else: else:
ext_name = None vol["name"] = f"{proj_name}_{source}"
vol["name"] = ext_name if ext_name else f"{proj_name}_{source}"
return mount_dict return mount_dict