Beispiel #1
0
    def validateCorePluginsEnabled(self, doc):
        """
        Ensures that the set of plugins passed in is a list of valid plugin
        names. Removes any invalid plugin names, removes duplicates, and adds
        all transitive dependencies to the enabled list.
        """
        if not type(doc['value']) is list:
            raise ValidationException(
                'Plugins enabled setting must be a list.', 'value')

        allPlugins = plugin_utilities.findAllPlugins()
        doc['value'] = set(doc['value'])

        def addDeps(plugin):
            for dep in allPlugins[plugin]['dependencies']:
                if dep not in doc['value']:
                    doc['value'].add(dep)
                addDeps(dep)

        for enabled in list(doc['value']):
            if enabled in allPlugins:
                addDeps(enabled)
            else:
                doc['value'].remove(enabled)

        doc['value'] = list(doc['value'])
Beispiel #2
0
    def validateCorePluginsEnabled(self, doc):
        """
        Ensures that the set of plugins passed in is a list of valid plugin
        names. Removes any invalid plugin names, removes duplicates, and adds
        all transitive dependencies to the enabled list.
        """
        if not type(doc['value']) is list:
            raise ValidationException(
                'Plugins enabled setting must be a list.', 'value')

        allPlugins = plugin_utilities.findAllPlugins()
        doc['value'] = set(doc['value'])

        def addDeps(plugin):
            for dep in allPlugins[plugin]['dependencies']:
                if dep not in doc['value']:
                    doc['value'].add(dep)
                addDeps(dep)

        for enabled in list(doc['value']):
            if enabled in allPlugins:
                addDeps(enabled)
            else:
                doc['value'].remove(enabled)

        doc['value'] = list(doc['value'])
Beispiel #3
0
def _getGitVersions():
    """
    Use git to query the versions of the core deployment and all plugins.

    :returns: a dictionary with 'core' and each plugin, each with git
        version information if it can be found.
    """
    gitCommands = collections.OrderedDict([
        ('SHA', ['rev-parse', 'HEAD']),
        ('shortSHA', ['rev-parse', '--short', 'HEAD']),
        ('lastCommitTime', ['log', '--format="%ai"', '-n1', 'HEAD']),
        ('branch', ['rev-parse', '--abbrev-ref', 'HEAD']),
    ])
    versions = {}
    paths = collections.OrderedDict()
    if hasattr(girder, '__file__'):
        paths['core'] = fix_path(
            os.path.dirname(os.path.dirname(girder.__file__)))
    for plugin in plugin_utilities.findAllPlugins():
        paths[plugin] = fix_path(
            os.path.join(plugin_utilities.getPluginDir(), plugin))
    for key in paths:
        if os.path.exists(paths[key]):
            for info, cmd in six.iteritems(gitCommands):
                value = subprocess.Popen(['git'] + cmd,
                                         shell=False,
                                         stdout=subprocess.PIPE,
                                         cwd=paths[key]).stdout.read()
                value = value.strip().decode('utf8', 'ignore').strip('"')
                if (info == 'SHA' and key != 'core'
                        and value == versions.get('core', {}).get('SHA', '')):
                    break
                versions.setdefault(key, {})[info] = value
    return versions
Beispiel #4
0
def _getGitVersions():
    """
    Use git to query the versions of the core deployment and all plugins.

    :returns: a dictionary with 'core' and each plugin, each with git
        version information if it can be found.
    """
    gitCommands = collections.OrderedDict([
        ('SHA', ['rev-parse', 'HEAD']),
        ('shortSHA', ['rev-parse', '--short', 'HEAD']),
        ('lastCommitTime', ['log', '--format="%ai"', '-n1', 'HEAD']),
        ('branch', ['rev-parse', '--abbrev-ref', 'HEAD']),
    ])
    versions = {}
    paths = collections.OrderedDict()
    if hasattr(girder, '__file__'):
        paths['core'] = fix_path(os.path.dirname(os.path.dirname(girder.__file__)))
    for plugin in plugin_utilities.findAllPlugins():
        paths[plugin] = fix_path(os.path.join(plugin_utilities.getPluginDir(), plugin))
    for key in paths:
        if os.path.exists(paths[key]):
            for info, cmd in six.iteritems(gitCommands):
                value = subprocess.Popen(
                    ['git'] + cmd,
                    shell=False,
                    stdout=subprocess.PIPE,
                    cwd=paths[key]).stdout.read()
                value = value.strip().decode('utf8', 'ignore').strip('"')
                if (info == 'SHA' and key != 'core' and
                        value == versions.get('core', {}).get('SHA', '')):
                    break
                versions.setdefault(key, {})[info] = value
    return versions
Beispiel #5
0
 def getPlugins(self, params):
     """
     Return the plugin information for the system. This includes a list of
     all of the currently enabled plugins, as well as
     """
     return {
         'all': plugin_utilities.findAllPlugins(),
         'enabled': self.model('setting').get(SettingKey.PLUGINS_ENABLED)
     }
Beispiel #6
0
 def getPlugins(self):
     plugins = {
         'all': plugin_utilities.findAllPlugins(),
         'enabled': Setting().get(SettingKey.PLUGINS_ENABLED)
     }
     failureInfo = plugin_utilities.getPluginFailureInfo()
     if failureInfo:
         plugins['failed'] = failureInfo
     return plugins
Beispiel #7
0
 def getPlugins(self):
     plugins = {
         'all': plugin_utilities.findAllPlugins(),
         'enabled': Setting().get(SettingKey.PLUGINS_ENABLED)
     }
     failureInfo = plugin_utilities.getPluginFailureInfo()
     if failureInfo:
         plugins['failed'] = failureInfo
     return plugins
Beispiel #8
0
 def getPlugins(self, params):
     """
     Return the plugin information for the system. This includes a list of
     all of the currently enabled plugins, as well as
     """
     return {
         'all': plugin_utilities.findAllPlugins(),
         'enabled': self.model('setting').get(SettingKey.PLUGINS_ENABLED)
     }
Beispiel #9
0
 def getPlugins(self, params):
     return {
         'all': plugin_utilities.findAllPlugins(),
         'enabled': self.model('setting').get(SettingKey.PLUGINS_ENABLED)
     }
Beispiel #10
0
 def getPlugins(self, params):
     return {
         'all': plugin_utilities.findAllPlugins(),
         'enabled': self.model('setting').get(SettingKey.PLUGINS_ENABLED)
     }