Merge "deploy precheck circular dependency"

This commit is contained in:
Zuul
2024-08-27 17:48:36 +00:00
committed by Gerrit Code Review
2 changed files with 23 additions and 1 deletions

View File

@@ -126,6 +126,22 @@ class HealthCheck(object):
method = 'GET'
output = upgrade_utils.call_api(self._sysinv_token, method, api_cmd)
# check hosts are patch current
deploy_in_progress = self._config.get("deploy_in_progress", "{}")
deploy_in_progress = json.loads(deploy_in_progress)
if deploy_in_progress:
success = False
from_load = deploy_in_progress["from_release"]
to_load = deploy_in_progress["to_release"]
output += ('All hosts are patch current: [%s]\n') \
% (HealthCheck.FAIL_MSG)
output += ('Deployment in progress: %s to %s\n' % (from_load, to_load))
else:
success = True
output += ('All hosts are patch current: [%s]\n') \
% (HealthCheck.SUCCESS_MSG)
health_ok = health_ok and success
if HealthCheck.FAIL_MSG in output:
success = False
health_ok = health_ok and success
@@ -365,6 +381,9 @@ def parse_config(args=None):
parser.add_argument("--releases",
help="Releases",
default="[]")
parser.add_argument("--deploy_in_progress",
help="check hosts are patch current",
default="{}")
# if args was not passed will use sys.argv by default
parsed_args = parser.parse_args(args)

View File

@@ -2490,6 +2490,8 @@ class PatchController(PatchService):
"Use --force option to execute deploy precheck script.\n"
return dict(info=msg_info, warning=msg_warning, error=msg_error, system_healthy=True)
deploy_in_progress = self._get_software_upgrade()
# parse local config file to pass parameters to precheck script
try:
cp = configparser.ConfigParser()
@@ -2531,7 +2533,8 @@ class PatchController(PatchService):
"--user_domain_name=%s" % user_domain_name,
"--project_domain_name=%s" % project_domain_name,
"--region_name=%s" % region_name,
"--releases=%s" % json.dumps(releases)]
"--releases=%s" % json.dumps(releases),
"--deploy_in_progress=%s" % json.dumps(deploy_in_progress)]
if force:
cmd.append("--force")
if patch: