be safer on retrieving objects

when object is public, there is no guarantee that
all resources are shared between tenants. so, it's
better to safer on case of retrieving additional information
about cluster details.

Change-Id: Ib0d9b4d324f40504d3540d2716df64dd8e206af5
Closes-bug: 1588795
This commit is contained in:
Vitaly Gridnev 2016-07-15 12:09:29 +03:00
parent bcf8e2938d
commit d288c54073
2 changed files with 20 additions and 8 deletions

View File

@ -0,0 +1,3 @@
---
fixes:
- Fixed issue with retrieving details for public clusters.

View File

@ -71,8 +71,13 @@ class GeneralTab(tabs.Tab):
if str(val).startswith(('http://', 'https://')):
cluster.info[info_key][key] = build_link(val)
base_image = glance.image_get(request,
cluster.default_image_id)
try:
base_image = glance.image_get(request,
cluster.default_image_id)
except Exception:
exceptions.handle(
request, _("Unable to fetch base image details"))
base_image = {}
if getattr(cluster, 'cluster_template_id', None):
cluster_template = saharaclient.safe_call(
@ -80,12 +85,16 @@ class GeneralTab(tabs.Tab):
cluster.cluster_template_id)
else:
cluster_template = None
if getattr(cluster, 'neutron_management_network', None):
net_id = cluster.neutron_management_network
network = neutron.network_get(request, net_id)
net_name = network.name_or_id
else:
try:
if getattr(cluster, 'neutron_management_network', None):
net_id = cluster.neutron_management_network
network = neutron.network_get(request, net_id)
net_name = network.name_or_id
else:
net_name = None
except Exception:
exceptions.handle(
request, _("Unable to fetch network details"))
net_name = None
cluster_info.update({"cluster": cluster,