示例#1
0
    def get_context_data(self, request):
        cluster_id = self.tab_group.kwargs['cluster_id']
        sahara = saharaclient(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 = helpers.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)
            network.set_id_as_name_if_empty()
            net_name = network.name
        else:
            net_name = None

        return {
            "cluster": cluster,
            "base_image": base_image,
            "cluster_template": cluster_template,
            "network": net_name
        }
示例#2
0
    def get_context_data(self, request):
        cluster_id = self.tab_group.kwargs['cluster_id']
        sahara = saharaclient(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 = helpers.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)
            network.set_id_as_name_if_empty()
            net_name = network.name
        else:
            net_name = None

        return {"cluster": cluster,
                "base_image": base_image,
                "cluster_template": cluster_template,
                "network": net_name}
示例#3
0
 def get_context_data(self, request):
     template_id = self.tab_group.kwargs['template_id']
     sahara = saharaclient(request)
     template = sahara.cluster_templates.get(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"] = helpers.safe_call(
             sahara.node_group_templates.get,
             ng.get("node_group_template_id", None))
     return {"template": template}
示例#4
0
 def get_context_data(self, request):
     template_id = self.tab_group.kwargs['template_id']
     sahara = saharaclient(request)
     template = sahara.cluster_templates.get(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"] = helpers.safe_call(
             sahara.node_group_templates.get,
             ng.get("node_group_template_id", None))
     return {"template": template}