Merge "Allow upgrade-related health checks to use --force"

This commit is contained in:
Zuul 2023-11-07 13:35:46 +00:00 committed by Gerrit Code Review
commit 6d22561256
2 changed files with 13 additions and 6 deletions

View File

@ -16,12 +16,16 @@ class HealthManager(base.Manager):
resp, body = self.api.json_request('GET', path)
return body
def get_upgrade(self):
def get_upgrade(self, relaxed=None):
path = '/v1/health/upgrade'
if relaxed:
path += '/relaxed'
resp, body = self.api.json_request('GET', path)
return body
def get_kube_upgrade(self):
def get_kube_upgrade(self, relaxed=None):
path = '/v1/health/kube-upgrade'
if relaxed:
path += '/relaxed'
resp, body = self.api.json_request('GET', path)
return body

View File

@ -33,13 +33,16 @@ class HealthController(rest.RestController):
"Unable to perform health query."))
return output
@wsme_pecan.wsexpose(wtypes.text, wtypes.text)
def get_one(self, upgrade):
@wsme_pecan.wsexpose(wtypes.text, wtypes.text, wtypes.text)
def get_one(self, upgrade, relaxed=None):
"""Validates the health of the system for an upgrade"""
force = False
if relaxed:
force = True
if upgrade == 'upgrade':
try:
success, output = pecan.request.rpcapi.get_system_health(
pecan.request.context, upgrade=True)
pecan.request.context, upgrade=True, force=force)
except Exception as e:
LOG.exception(e)
raise wsme.exc.ClientSideError(_(
@ -48,7 +51,7 @@ class HealthController(rest.RestController):
elif upgrade == 'kube-upgrade':
try:
success, output = pecan.request.rpcapi.get_system_health(
pecan.request.context, kube_upgrade=True)
pecan.request.context, kube_upgrade=True, force=force)
except Exception as e:
LOG.exception(e)
raise wsme.exc.ClientSideError(_(