Add check for disable_upgrade_deployment flag in roles_data

Check that the disable_upgrade_deployment flag is set in any
operator provided roles_data.yaml file (the --roles-file
parameter).

This is an alternative proposal to
I9327f42bfbebf050f79224ee1c1ff41e49b9c2fd and the advantage
here is that we can use the existing validation_warnings_fatal
to raise the exception or stay at logging a warning. The
validation_warnings_fatal defaults to False.

Related-Bug: 1699792
Change-Id: I606a3010e7ecd83f34b852a35ed298c30f65adeb
This commit is contained in:
marios 2017-07-07 16:29:42 +03:00 committed by Marios Andreou
parent 3d4e2d20e8
commit fe280a2fae
2 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,8 @@
---
upgrade:
- If the operator specifies a roles_data.yaml for the deployment or upgrade
this adds a check that the disable_upgrade_deployment flag is set at least
once in that file and otherwise logs a warning. If the
validation-warnings-fatal parameter is set to True (default is False) then
this check will also raise an InvalidConfiguration exception.

View File

@ -567,6 +567,25 @@ class DeployOvercloud(command.Command):
"Error: The following files were not found: {0}".format(
", ".join(nonexisting_envs)))
# Check if disable_upgrade_deployment is set once
self.log.debug("Checking that the disable_upgrade_deployment flag "
"is set at least once in the roles file")
if parsed_args.roles_file:
roles_data = yaml.safe_load(open(parsed_args.roles_file).read())
disable_upgrade_deployment_set = False
for r in roles_data:
if r.get("disable_upgrade_deployment"):
disable_upgrade_deployment_set = True
break
if not disable_upgrade_deployment_set:
self.log.warning(
"The disable_upgrade_deployment flag is not set in the "
"roles file. This flag is expected when you have a "
"nova-compute or swift-storage role. Please check the "
"contents of the roles file: %s" % roles_data)
if parsed_args.validation_warnings_fatal:
raise exceptions.InvalidConfiguration()
def _get_default_role_counts(self, parsed_args):
if parsed_args.roles_file: