Merge "Fix: modify rollback software rule for deployment"

This commit is contained in:
Zuul 2024-10-30 15:24:10 +00:00 committed by Gerrit Code Review
commit 795288a1f9

View File

@ -568,8 +568,6 @@ class DeployRollbackSoftware(tables.Action):
verbose_name = _("Rollback Software")
def allowed(self, request, host=None):
if host is None:
return True
valid_states = {
"rollback-deploying",
@ -579,6 +577,9 @@ class DeployRollbackSoftware(tables.Action):
release_on = stx_api.usm.deploy_show_req(request)
deploy_host = stx_api.usm.get_deploy_host(request, host.hostname)
if host is None:
return True
if deploy_host is None or release_on is None or len(release_on) == 0:
return False
@ -588,8 +589,7 @@ class DeployRollbackSoftware(tables.Action):
release_on[0]['state'] == 'host-rollback'
)
return (host_locked(host) and is_valid_host_state and
is_valid_release_state)
return is_valid_host_state and is_valid_release_state
def single(self, table, request, host_id):