Update http status code for rejected precheck

Currently the rejected deploy precheck returns
http status code 200, which is not ideal for
integration apps like VIM. Changing the status
code according to error.

Test Plan:
[PASS] Check proper status code is returned for
software deploy precheck when alarm is present

Story: 2010676
Task: 50715
Change-Id: I67de30da2014e7153fb0c58d88545cdedb8c220f
Signed-off-by: sshathee <shunmugam.shatheesh@windriver.com>
This commit is contained in:
sshathee 2024-08-01 01:47:11 -04:00
parent 0562755ef1
commit 574290318c

View File

@ -2420,7 +2420,15 @@ class PatchController(PatchService):
# TODO(jvazhapp): fix patch flag for prepatched iso scenario
patch = (not utils.is_upgrade_deploy(SW_VERSION, release_version) and
version.Version(release_version).micro != 0)
return self._deploy_precheck(release_version, force, region_name, patch)
ret = self._deploy_precheck(release_version, force, region_name, patch)
if ret:
if ret.get("system_healthy") is None:
ret["error"] = "Fail to perform deploy precheck. Internal error has occurred.\n" + \
ret.get("error")
elif not ret.get("system_healthy"):
ret["error"] = "The following issues have been detected, which prevent " \
"deploying %s\n" % deployment + ret.get("info")
return ret
def _deploy_upgrade_start(self, to_release, commit_id):
LOG.info("start deploy upgrade to %s from %s" % (to_release, SW_VERSION))