def populate_cluster_template_choices(self, request, context): templates = saharaclient.cluster_template_list(request) plugin, hadoop_version = whelpers.\ get_plugin_and_hadoop_version(request) choices = [(template.id, template.name) for template in templates if (template.hadoop_version == hadoop_version and template.plugin_name == plugin)] if not choices: choices.append(("", _("No Templates Available"))) # cluster_template_id comes from cluster templates table, when # Create Cluster from template is clicked there selected_template_name = None if request.REQUEST.get("cluster_template_name"): selected_template_name = ( request.REQUEST.get("cluster_template_name")) if selected_template_name: for template in templates: if template.name == selected_template_name: selected_template_id = template.id break else: selected_template_id = ( request.REQUEST.get("cluster_template_id", None)) for template in templates: if template.id == selected_template_id: self.fields['cluster_template'].initial = template.id return choices
def populate_cluster_template_choices(self, request, context): templates = saharaclient.cluster_template_list(request) plugin, hadoop_version = whelpers.\ get_plugin_and_hadoop_version(request) choices = [(template.id, template.name) for template in templates if (template.hadoop_version == hadoop_version and template.plugin_name == plugin)] if not choices: choices.append(("", _("No Templates Available"))) # cluster_template_id comes from cluster templates table, when # Create Cluster from template is clicked there selected_template_name = None resolver_match = urlresolvers.resolve(request.path) if "cluster_template_name" in resolver_match.kwargs: selected_template_name = ( resolver_match.kwargs["cluster_template_name"]) if selected_template_name: for template in templates: if template.name == selected_template_name: selected_template_id = template.id break else: selected_template_id = (request.REQUEST.get( "cluster_template_id", None)) for template in templates: if template.id == selected_template_id: self.fields['cluster_template'].initial = template.id return choices
def get_data(self): try: cluster_templates = saharaclient.cluster_template_list( self.request) except Exception: cluster_templates = [] exceptions.handle(self.request, _("Unable to fetch cluster template list")) return cluster_templates
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']} cluster_templates = saharaclient.cluster_template_list( self.request, search_opts) except Exception: cluster_templates = [] exceptions.handle(self.request, _("Unable to fetch cluster template list")) return cluster_templates
def populate_cluster_template_choices(self, request, context): templates = saharaclient.cluster_template_list(request) plugin, hadoop_version = whelpers.\ get_plugin_and_hadoop_version(request) choices = [(template.id, template.name) for template in templates if (template.hadoop_version == hadoop_version and template.plugin_name == plugin)] # cluster_template_id comes from cluster templates table, when # Create Cluster from template is clicked there selected_template_id = request.REQUEST.get("cluster_template_id", None) for template in templates: if template.id == selected_template_id: self.fields['cluster_template'].initial = template.id return choices
def get_data(self): cluster_templates = saharaclient.cluster_template_list(self.request) return cluster_templates