From c30ae0e06e5397141816e97bdd05dd3da35e7957 Mon Sep 17 00:00:00 2001 From: Valerii Kovalchuk Date: Tue, 12 Jul 2016 18:47:44 +0300 Subject: [PATCH] Fix allowance of Deploy environment action Previously action's allow() method didn't consider situation when component was deleted from deployed environment as the valid case to show the button. This patch fixes that by simply checking env's status to be 'pending' or 'deploy failure'. Change-Id: I40d62d4fcb620e7f2ffc515884c755abf6b8421c Closes-bug: #1594354 --- muranodashboard/environments/tables.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/muranodashboard/environments/tables.py b/muranodashboard/environments/tables.py index c62be808e..f32b7004b 100644 --- a/muranodashboard/environments/tables.py +++ b/muranodashboard/environments/tables.py @@ -276,11 +276,8 @@ class DeployEnvironment(tables.BatchAction): def allowed(self, request, environment): """Limit when 'Deploy Environment' button is shown - 'Deploy environment' is not shown in several cases: - * when deploy is already in progress - * delete is in progress - * no new services added to the environment (after env creation - or successful deploy or delete failure) + 'Deploy environment' is shown when set of environment's services + changed or previous deploy failed. If environment has already deployed services, button is shown as 'Update environment' """ @@ -298,13 +295,10 @@ class DeployEnvironment(tables.BatchAction): self.action_past = self.action_past_deploy status = getattr(environment, 'status', None) - if (status != consts.STATUS_ID_DEPLOY_FAILURE and - not environment.has_new_services): - return False - if (status in consts.NO_ACTION_ALLOWED_STATUSES or - status == consts.STATUS_ID_READY): - return False - return True + if status in (consts.STATUS_ID_PENDING, + consts.STATUS_ID_DEPLOY_FAILURE): + return True + return False def action(self, request, environment_id): try: