Esempio n. 1
0
 def image_name(self):
     from glanceclient.common import exceptions as glance_exceptions
     from horizon.api import glance
     try:
         image = glance.image_get(self.request, self.image['id'])
         return image.name
     except glance_exceptions.ClientException:
         return "(not found)"
Esempio n. 2
0
 def image_name(self):
     import glanceclient.exc as glance_exceptions
     from horizon.api import glance
     try:
         image = glance.image_get(self.request, self.image['id'])
         return image.name
     except glance_exceptions.ClientException:
         return "(not found)"
Esempio n. 3
0
 def image_name(self):
     from glance.common import exception as glance_exceptions
     from horizon.api import glance
     try:
         image = glance.image_get(self.request, self.image['id'])
         return image.name
     except glance_exceptions.NotFound:
         return "(not found)"
Esempio n. 4
0
def list_clusters(request):
    token = request.user.token.id
    resp = requests.get(
        get_eho_address(request) + "/clusters",
        headers={"x-auth-token": token})
    if resp.status_code == 200:
        clusters_arr = resp.json["clusters"]
        clusters = []
        for cl in clusters_arr:
            id = cl["id"]
            name = cl["name"]
            base_image_id = cl["base_image_id"]
            base_image_name = glance.image_get(request, base_image_id).name
            node_templates = cl["node_templates"]
            status = cl["status"]
            nodes = cl["nodes"]
            cluster = Cluster(id, name, _format_templates(node_templates),
                              base_image_name, status, len(nodes))
            clusters.append(cluster)
        return clusters
    else:
        return []
Esempio n. 5
0
 def get_context_data(self, request):
     cluster = get_cluster(request, self.tab_group.kwargs["cluster_id"])
     base_image_name = glance.image_get(request, cluster["base_image_id"]).name
     return {"cluster": cluster, "base_image_name": base_image_name}