Example #1
0
    def __init__(self, request, *args, **kwargs):
        super(SelectPluginAction, self).__init__(request, *args, **kwargs)

        try:
            plugins = saharaclient.plugin_list(request)
        except Exception:
            plugins = []
            exceptions.handle(request, _("Unable to fetch plugin list."))
        plugin_choices = [(plugin.name, plugin.title) for plugin in plugins]

        self.fields["plugin_name"] = forms.ChoiceField(
            label=_("Plugin name"),
            choices=plugin_choices,
            widget=forms.Select(attrs={"class": "plugin_name_choice"}))

        for plugin in plugins:
            field_name = plugin.name + "_version"
            choice_field = forms.ChoiceField(
                label=_("Version"),
                choices=[(version, version) for version in plugin.versions],
                widget=forms.Select(
                    attrs={
                        "class": "plugin_version_choice " + field_name +
                        "_choice"
                    }))
            self.fields[field_name] = choice_field
Example #2
0
    def __init__(self, request, *args, **kwargs):
        super(SelectPluginAction, self).__init__(request, *args, **kwargs)

        try:
            plugins = saharaclient.plugin_list(request)
        except Exception:
            plugins = []
            exceptions.handle(request,
                              _("Unable to fetch plugin list."))
        plugin_choices = [(plugin.name, plugin.title) for plugin in plugins]

        self.fields["plugin_name"] = forms.ChoiceField(
            label=_("Plugin name"),
            choices=plugin_choices,
            widget=forms.Select(attrs={"class": "plugin_name_choice"}))

        for plugin in plugins:
            field_name = plugin.name + "_version"
            choice_field = forms.ChoiceField(
                label=_("Version"),
                choices=[(version, version) for version in plugin.versions],
                widget=forms.Select(
                    attrs={"class": "plugin_version_choice "
                                    + field_name + "_choice"})
            )
            self.fields[field_name] = choice_field
Example #3
0
 def get_data(self):
     try:
         plugins = saharaclient.plugin_list(self.request)
     except Exception:
         plugins = []
         msg = _('Unable to retrieve data processing plugins.')
         exceptions.handle(self.request, msg)
     return plugins
Example #4
0
 def get_data(self):
     try:
         plugins = saharaclient.plugin_list(self.request)
     except Exception:
         plugins = []
         msg = _('Unable to retrieve data processing plugins.')
         exceptions.handle(self.request, msg)
     return plugins
Example #5
0
def update_context_with_plugin_tags(request, context):
    try:
        plugins = saharaclient.plugin_list(request)
    except Exception:
        plugins = []
        msg = _("Unable to process plugin tags")
        exceptions.handle(request, msg)

    plugins_object = dict()
    for plugin in plugins:
        plugins_object[plugin.name] = dict()
        for version in plugin.versions:
            try:
                details = saharaclient. \
                    plugin_get_version_details(request,
                                               plugin.name,
                                               version)
                plugins_object[plugin.name][version] = (
                    details.required_image_tags)
            except Exception:
                msg = _("Unable to process plugin tags")
                exceptions.handle(request, msg)

    context["plugins"] = plugins_object
Example #6
0
def update_context_with_plugin_tags(request, context):
    try:
        plugins = saharaclient.plugin_list(request)
    except Exception:
        plugins = []
        msg = _("Unable to process plugin tags")
        exceptions.handle(request, msg)

    plugins_object = dict()
    for plugin in plugins:
        plugins_object[plugin.name] = dict()
        for version in plugin.versions:
            try:
                details = saharaclient. \
                    plugin_get_version_details(request,
                                               plugin.name,
                                               version)
                plugins_object[plugin.name][version] = (
                    details.required_image_tags)
            except Exception:
                msg = _("Unable to process plugin tags")
                exceptions.handle(request, msg)

    context["plugins"] = plugins_object