From 71124d6d8089bc02d2c731cc9d586beb4fab3227 Mon Sep 17 00:00:00 2001 From: Italo Lemos Date: Tue, 22 Oct 2024 11:02:23 -0300 Subject: [PATCH] Fix: modify rollback software rule for deployment This change removes the lock host rule to make the deployment abort action more intuitive. TEST PLAN: [PASS] Build, install. [PASS] Upload a patch release and start the deployment process. After deploy the host trigger the deploy abort action. The Rollback Software option then should be available for each host in Host Inventory Table. Story: 2010676 Task: 51201 Change-Id: I7ffe9377ff7d87ffbe5f365ec233891e529619e8 Signed-off-by: Italo Lemos --- .../dashboards/admin/inventory/tables.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/tables.py b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/tables.py index f2a94bbe..4dfbbe6a 100644 --- a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/tables.py +++ b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/tables.py @@ -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):