def get_context_data(self, request): cluster_id = self.tab_group.kwargs['cluster_id'] try: sahara = saharaclient.client(request) cluster = sahara.clusters.get(cluster_id) for ng in cluster.node_groups: if ng["flavor_id"]: ng["flavor_name"] = ( nova.flavor_get(request, ng["flavor_id"]).name) if ng["floating_ip_pool"]: ng["floating_ip_pool_name"] = ( self._get_floating_ip_pool_name( request, ng["floating_ip_pool"])) if ng.get("node_group_template_id", None): ng["node_group_template"] = saharaclient.safe_call( sahara.node_group_templates.get, ng["node_group_template_id"]) ng["security_groups_full"] = helpers.get_security_groups( request, ng["security_groups"]) except Exception: cluster = {} exceptions.handle(request, _("Unable to get node group details.")) return {"cluster": cluster}
def get_context_data(self, request): cluster_id = self.tab_group.kwargs['cluster_id'] try: sahara = saharaclient.client(request) cluster = sahara.clusters.get(cluster_id) for ng in cluster.node_groups: if ng["flavor_id"]: ng["flavor_name"] = (nova.flavor_get( request, ng["flavor_id"]).name) if ng["floating_ip_pool"]: ng["floating_ip_pool_name"] = ( self._get_floating_ip_pool_name( request, ng["floating_ip_pool"])) if ng.get("node_group_template_id", None): ng["node_group_template"] = saharaclient.safe_call( sahara.node_group_templates.get, ng["node_group_template_id"]) ng["security_groups_full"] = helpers.get_security_groups( request, ng["security_groups"]) except Exception: cluster = {} exceptions.handle(request, _("Unable to get node group details.")) return {"cluster": cluster}
def get_context_data(self, request): template_id = self.tab_group.kwargs['template_id'] try: template = saharaclient.cluster_template_get(request, template_id) for ng in template.node_groups: if not ng["flavor_id"]: continue ng["flavor_name"] = (nova.flavor_get(request, ng["flavor_id"]).name) ng["node_group_template"] = saharaclient.safe_call( saharaclient.nodegroup_template_get, request, ng.get("node_group_template_id", None)) ng["security_groups_full"] = helpers.get_security_groups( request, ng.get("security_groups")) except Exception: template = {} exceptions.handle(request, _("Unable to fetch node group details.")) return {"template": template}
def get_context_data(self, request): template_id = self.tab_group.kwargs['template_id'] try: template = saharaclient.cluster_template_get(request, template_id) for ng in template.node_groups: if not ng["flavor_id"]: continue ng["flavor_name"] = ( nova.flavor_get(request, ng["flavor_id"]).name) ng["node_group_template"] = saharaclient.safe_call( saharaclient.nodegroup_template_get, request, ng.get("node_group_template_id", None)) ng["security_groups_full"] = helpers.get_security_groups( request, ng.get("security_groups")) except Exception: template = {} exceptions.handle(request, _("Unable to fetch node group details.")) return {"template": template}
def get_context_data(self, request): cluster_id = self.tab_group.kwargs['cluster_id'] cluster_info = {} try: sahara = saharaclient.client(request) cluster = sahara.clusters.get(cluster_id) for info_key, info_val in cluster.info.items(): for key, val in info_val.items(): if str(val).startswith(('http://', 'https://')): cluster.info[info_key][key] = build_link(val) base_image = glance.image_get(request, cluster.default_image_id) if getattr(cluster, 'cluster_template_id', None): cluster_template = saharaclient.safe_call( sahara.cluster_templates.get, 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: net_name = None cluster_info.update({"cluster": cluster, "base_image": base_image, "cluster_template": cluster_template, "network": net_name}) except Exception as e: LOG.error("Unable to fetch cluster details: %s" % str(e)) return cluster_info
def get_context_data(self, request): cluster_id = self.tab_group.kwargs['cluster_id'] cluster_info = {} try: sahara = saharaclient.client(request) cluster = sahara.clusters.get(cluster_id) for info_key, info_val in cluster.info.items(): for key, val in info_val.items(): if str(val).startswith(('http://', 'https://')): cluster.info[info_key][key] = build_link(val) base_image = glance.image_get(request, cluster.default_image_id) if getattr(cluster, 'cluster_template_id', None): cluster_template = saharaclient.safe_call( sahara.cluster_templates.get, 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: net_name = None cluster_info.update({ "cluster": cluster, "base_image": base_image, "cluster_template": cluster_template, "network": net_name }) except Exception as e: LOG.error("Unable to fetch cluster details: %s" % str(e)) return cluster_info