summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlin-hua-cheng <os.lcheng@gmail.com>2015-04-22 14:45:26 -0700
committerDavid Lyle <dklyle0@gmail.com>2015-04-23 09:43:14 -0600
commit624a85c7eee4e4fb4f88ccc8bd52caa6c0423e89 (patch)
tree8e1440be3afe84589b09a9869dd7d4b860a52b92
parentb2ef08b98bbd8d73162b90de57e5baa7fcb8c36d (diff)
downloadhorizon-624a85c7eee4e4fb4f88ccc8bd52caa6c0423e89.tar.gz
Initialize variable 'networks' before referencing
Fixes the possible UnboundLocalError on the utility class. Change-Id: I52d27f90a583f1216a927147d1bd414c5f866608 Closes-Bug: #1444421 (cherry picked from commit 2e4996d2d220df0ae36a863fe694706e6f7aeb40)
-rw-r--r--openstack_dashboard/dashboards/project/instances/utils.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/openstack_dashboard/dashboards/project/instances/utils.py b/openstack_dashboard/dashboards/project/instances/utils.py
index 730701247..5c2880126 100644
--- a/openstack_dashboard/dashboards/project/instances/utils.py
+++ b/openstack_dashboard/dashboards/project/instances/utils.py
@@ -86,6 +86,7 @@ def network_field_data(request, include_empty_option=False):
:return: list of (id, name) tuples
"""
tenant_id = request.user.tenant_id
+ networks = []
try:
networks = api.neutron.network_list_for_tenant(request, tenant_id)
networks = [(n.id, n.name_or_id) for n in networks]
@@ -121,7 +122,6 @@ def keypair_field_data(request, include_empty_option=False):
keypair_list = [(kp.name, kp.name) for kp in keypairs]
except Exception:
exceptions.handle(request, _('Unable to retrieve key pairs.'))
- keypair_list = []
if not keypair_list:
if include_empty_option: