Browse Source

Improve handling of empty resource_registry

It's possible that content["resource_registry"] might
not exist or be iterable so wrap the reference to it
with a try/except for a KeyError or TypeError and continue
the deployment without the empty resource_registry instead
of failing.

Change-Id: Ic7d88382a0ff15c24800f12ddbf69f13d6804b28
Closes-Bug: #1833743
tags/12.1.0
John Fulton 11 months ago
parent
commit
96d39dc106
1 changed files with 4 additions and 3 deletions
  1. +4
    -3
      tripleoclient/utils.py

+ 4
- 3
tripleoclient/utils.py View File

@@ -1876,14 +1876,15 @@ def check_file_for_enabled_service(env_file):
content = yaml.load(open(env_file))
deprecated_services_enabled = []
for service in constants.DEPRECATED_SERVICES.keys():
if ("resource_registry" in content and
service in content["resource_registry"]):
try:
if content["resource_registry"][service] != "OS::Heat::None":
LOG.warn("service " + service + " is enabled in "
+ str(env_file) + ". " +
constants.DEPRECATED_SERVICES[service])
deprecated_services_enabled.append(service)

except (KeyError, TypeError) as e:
# ignore if content["resource_registry"] is empty
pass
if deprecated_services_enabled:
confirm = prompt_user_for_confirmation(
message="Do you still wish to continue with deployment [y/N]",


Loading…
Cancel
Save