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>
This commit is contained in:
parent
cad32f38c3
commit
51695e284b
|
@ -3061,7 +3061,12 @@ def check_prohibited_overrides(protected_overrides, user_environments):
|
||||||
for env_path, abs_env_path in user_environments:
|
for env_path, abs_env_path in user_environments:
|
||||||
with open(env_path, 'r') as file:
|
with open(env_path, 'r') as file:
|
||||||
data = yaml.safe_load(file.read())
|
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)
|
conflicts = set(protected_registry.keys()).intersection(registry)
|
||||||
if not conflicts:
|
if not conflicts:
|
||||||
|
|
Loading…
Reference in New Issue