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
This commit is contained in:
parent
274853a1b4
commit
c30ae0e06e
|
@ -276,11 +276,8 @@ class DeployEnvironment(tables.BatchAction):
|
||||||
def allowed(self, request, environment):
|
def allowed(self, request, environment):
|
||||||
"""Limit when 'Deploy Environment' button is shown
|
"""Limit when 'Deploy Environment' button is shown
|
||||||
|
|
||||||
'Deploy environment' is not shown in several cases:
|
'Deploy environment' is shown when set of environment's services
|
||||||
* when deploy is already in progress
|
changed or previous deploy failed.
|
||||||
* delete is in progress
|
|
||||||
* no new services added to the environment (after env creation
|
|
||||||
or successful deploy or delete failure)
|
|
||||||
If environment has already deployed services,
|
If environment has already deployed services,
|
||||||
button is shown as 'Update environment'
|
button is shown as 'Update environment'
|
||||||
"""
|
"""
|
||||||
|
@ -298,13 +295,10 @@ class DeployEnvironment(tables.BatchAction):
|
||||||
self.action_past = self.action_past_deploy
|
self.action_past = self.action_past_deploy
|
||||||
|
|
||||||
status = getattr(environment, 'status', None)
|
status = getattr(environment, 'status', None)
|
||||||
if (status != consts.STATUS_ID_DEPLOY_FAILURE and
|
if status in (consts.STATUS_ID_PENDING,
|
||||||
not environment.has_new_services):
|
consts.STATUS_ID_DEPLOY_FAILURE):
|
||||||
return False
|
return True
|
||||||
if (status in consts.NO_ACTION_ALLOWED_STATUSES or
|
return False
|
||||||
status == consts.STATUS_ID_READY):
|
|
||||||
return False
|
|
||||||
return True
|
|
||||||
|
|
||||||
def action(self, request, environment_id):
|
def action(self, request, environment_id):
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue