From 1cc9c0afafc11c053741e911a978bf3f401cc323 Mon Sep 17 00:00:00 2001 From: David Lyle Date: Fri, 8 Mar 2013 15:06:55 -0700 Subject: [PATCH] Fixes uncaught exception on Add Monitor when unable to retrieve pools Variable instantiated in a try block referenced outside even when exception happens in the api call that instantiates the variable. Fixes: bug #1152770 Change-Id: Ic13db9ed87b2600357b0568ff6d01ef0fe28451c --- .../dashboards/project/loadbalancers/workflows.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openstack_dashboard/dashboards/project/loadbalancers/workflows.py b/openstack_dashboard/dashboards/project/loadbalancers/workflows.py index f473935cb..110a54d09 100644 --- a/openstack_dashboard/dashboards/project/loadbalancers/workflows.py +++ b/openstack_dashboard/dashboards/project/loadbalancers/workflows.py @@ -383,11 +383,11 @@ class AddMonitorAction(workflows.Action): pool_id_choices = [('', _("Select a Pool"))] try: pools = api.lbaas.pools_get(request) + for p in pools: + pool_id_choices.append((p.id, p.name)) except: exceptions.handle(request, _('Unable to retrieve pools list.')) - for p in pools: - pool_id_choices.append((p.id, p.name)) self.fields['pool_id'].choices = pool_id_choices type_choices = [('', _("Select Type"))]