Esempio n. 1
0
    def populate_cluster_choices(self, request, context):
        try:
            clusters = saharaclient.cluster_list(request)
        except Exception:
            clusters = []
            exceptions.handle(request, _("Unable to fetch clusters."))

        choices = [(cluster.id, cluster.name) for cluster in clusters]

        return choices
Esempio n. 2
0
 def get_data(self):
     try:
         search_opts = {}
         filter = self.get_server_filter_info(self.request)
         if filter['value'] and filter['field']:
             search_opts = {filter['field']: filter['value']}
         clusters = saharaclient.cluster_list(self.request, search_opts)
     except Exception:
         clusters = []
         exceptions.handle(self.request, _("Unable to fetch cluster list"))
     return clusters
Esempio n. 3
0
 def get_cluster_choices(self, request):
     choices = []
     try:
         clusters = saharaclient.cluster_list(request)
         choices = [
             ("%s %s" % (cl.name, helpers.ALLOWED_STATUSES.get(cl.status)),
              cl.status)
             for cl in clusters if (cl.status in helpers.ALLOWED_STATUSES)]
     except Exception:
         exceptions.handle(request, _("Unable to fetch clusters."))
     return choices
Esempio n. 4
0
 def get_cluster_choices(self, request):
     choices = []
     try:
         clusters = saharaclient.cluster_list(request)
         choices = [
             ("%s %s" % (cl.name, helpers.ALLOWED_STATUSES.get(cl.status)),
              cl.status) for cl in clusters
             if (cl.status in helpers.ALLOWED_STATUSES)
         ]
     except Exception:
         exceptions.handle(request, _("Unable to fetch clusters."))
     return choices
Esempio n. 5
0
    def populate_cluster_choices(self, request, context):
        try:
            clusters = saharaclient.cluster_list(request)
        except Exception:
            clusters = []
            exceptions.handle(request,
                              _("Unable to fetch clusters."))

        choices = [(cluster.id, cluster.name)
                   for cluster in clusters]

        return choices
Esempio n. 6
0
 def get_data(self):
     try:
         search_opts = {}
         filter = self.get_server_filter_info(self.request)
         if filter['value'] and filter['field']:
             search_opts = {filter['field']: filter['value']}
         clusters = saharaclient.cluster_list(self.request, search_opts)
     except Exception:
         clusters = []
         exceptions.handle(self.request,
                           _("Unable to fetch cluster list"))
     return clusters
Esempio n. 7
0
 def populate_cluster_choices(self, request, context):
     try:
         clusters = saharaclient.cluster_list(request)
     except Exception:
         clusters = []
         exceptions.handle(request,
                           _("Unable to fetch clusters."))
     choices = [(cl.id, "%s %s" % (cl.name,
                                   helpers.ALLOWED_STATUSES.get(cl.status)))
                for cl in clusters if cl.status in helpers.ALLOWED_STATUSES]
     if not choices:
         choices = [(None, _("No clusters available"))]
     return choices