Fixed status ne env
Change-Id: I56f789d2654244fddd8d583c058ebc0381a7dcda
This commit is contained in:
parent
fe02dd3272
commit
6b2d8b73cb
|
@ -90,6 +90,17 @@ def environments_list(request):
|
|||
log.debug('Environment::List')
|
||||
environments = muranoclient(request).environments.list()
|
||||
|
||||
for index, env in enumerate(environments):
|
||||
environments[index].has_services = False
|
||||
environment = environment_get(request, env.id)
|
||||
for service_name, instance in environment.services.iteritems():
|
||||
if instance:
|
||||
environments[index].has_services = True
|
||||
break
|
||||
if not environments[index].has_services:
|
||||
if environments[index].status == u'ready':
|
||||
environments[index].status = u'new'
|
||||
|
||||
log.debug('Environment::List {0}'.format(environments))
|
||||
return environments
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ LOG = logging.getLogger(__name__)
|
|||
STATUS_ID_READY = 'ready'
|
||||
STATUS_ID_PENDING = 'pending'
|
||||
STATUS_ID_DEPLOYING = 'deploying'
|
||||
STATUS_ID_NEW = 'new'
|
||||
|
||||
STATUS_CHOICES = (
|
||||
(None, True),
|
||||
|
@ -40,6 +41,7 @@ STATUS_DISPLAY_CHOICES = (
|
|||
(STATUS_ID_READY, 'Ready'),
|
||||
(STATUS_ID_DEPLOYING, 'Deploy in progress'),
|
||||
(STATUS_ID_PENDING, 'Configuring'),
|
||||
(STATUS_ID_NEW, 'Ready to configure'),
|
||||
('', 'Ready to configure'),
|
||||
)
|
||||
|
||||
|
@ -128,10 +130,8 @@ class DeployEnvironment(tables.BatchAction):
|
|||
def allowed(self, request, environment):
|
||||
status = getattr(environment, 'status', None)
|
||||
|
||||
if status not in [STATUS_ID_DEPLOYING]:
|
||||
services_presence = api.check_for_services(request, environment.id)
|
||||
if services_presence:
|
||||
return True
|
||||
if status not in [STATUS_ID_DEPLOYING] and environment.has_services:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
|
Loading…
Reference in New Issue