Browse Source

Guard against NoneType

If the resource registry data from a loaded file is None the method will
stacktrace resulting in a deployment failure. This change will ensure
that the data is loaded and in the event the resource_registry option is
None, it will set an empty set and carry on.

Change-Id: I09413d8b17657e9aeb38bc5a2d9ed44182ddf539
Signed-off-by: Kevin Carter <kecarter@redhat.com>
changes/91/824591/1
Kevin Carter 4 months ago
parent
commit
51695e284b
  1. 7
      tripleoclient/utils.py

7
tripleoclient/utils.py

@ -3061,7 +3061,12 @@ def check_prohibited_overrides(protected_overrides, user_environments):
for env_path, abs_env_path in user_environments:
with open(env_path, 'r') as file:
data = yaml.safe_load(file.read())
registry = set(data.get('resource_registry', {}).keys())
_resource_registry = data.get('resource_registry')
if isinstance(_resource_registry, dict):
registry = set(_resource_registry.keys())
else:
registry = set()
conflicts = set(protected_registry.keys()).intersection(registry)
if not conflicts:

Loading…
Cancel
Save