From 43a0bda3a40f8979912fd10ccc24a920ebea8fb5 Mon Sep 17 00:00:00 2001 From: Ekaterina Fedorova Date: Mon, 10 Jun 2013 16:29:48 +0400 Subject: [PATCH] Enable veiw services after deployment Change-Id: I8c3c780d0560100c120da5350b48a3bb1758b5c0 --- muranodashboard/panel/api.py | 2 +- muranodashboard/panel/tables.py | 6 +----- muranodashboard/panel/views.py | 7 +++---- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/muranodashboard/panel/api.py b/muranodashboard/panel/api.py index e5966f2f2..e234f6b5d 100644 --- a/muranodashboard/panel/api.py +++ b/muranodashboard/panel/api.py @@ -158,7 +158,7 @@ def get_service_client(request, service_type): def services_list(request, environment_id): services = [] - session_id = Session.get(request, environment_id) + session_id = Session.get_or_create(request, environment_id) get_environment = muranoclient(request).environments.get environment = get_environment(environment_id, session_id) diff --git a/muranodashboard/panel/tables.py b/muranodashboard/panel/tables.py index 5aefab137..67951df95 100644 --- a/muranodashboard/panel/tables.py +++ b/muranodashboard/panel/tables.py @@ -86,11 +86,7 @@ class DeleteEnvironment(tables.DeleteAction): return True def action(self, request, environment_id): - try: - api.environment_delete(request, environment_id) - except: - msg = _('Sorry, you can\'t delete this environment right now') - exceptions.handle(request, msg) + api.environment_delete(request, environment_id) class EditEnvironment(tables.LinkAction): diff --git a/muranodashboard/panel/views.py b/muranodashboard/panel/views.py index a48bc91c0..49315ad7d 100644 --- a/muranodashboard/panel/views.py +++ b/muranodashboard/panel/views.py @@ -167,10 +167,9 @@ class Services(tables.DataTableView): def get_context_data(self, **kwargs): context = super(Services, self).get_context_data(**kwargs) - try: context['environment_name'] = self.environment_name - except ArithmeticError: + except: msg = _('Sorry, you this environment does\'t exist anymore') redirect = reverse("horizon:project:murano:index") exceptions.handle(self.request, msg, redirect=redirect) @@ -208,11 +207,11 @@ class DetailServiceView(tabs.TabView): service_id = self.kwargs['service_id'] try: service = api.service_get(self.request, service_id) - except Exception as e: + except: redirect = reverse('horizon:project:murano:index') exceptions.handle(self.request, _('Unable to retrieve details for ' - 'service: %s' % e.message), + 'service'), redirect=redirect) else: self._service = service