コード例 #1
0
ファイル: LoggingRoot.py プロジェクト: DIRACGrid/DIRAC
  def __getBackendOptionsFromCFG(self, cfgPath, backend):
    """
    Get backend options from the configuration.

    :params cfgPath: string of the configuration path
    :params backend: string representing a backend identifier: stdout, file, f04
    """
    # We have to put the import lines here to avoid a dependancy loop
    from DIRAC import gConfig
    from DIRAC.ConfigurationSystem.Client.Helpers.Resources import getBackendConfig

    backendOptions = {}
    # Search backends config in the resources section
    retDictRessources = getBackendConfig(backend)
    if retDictRessources['OK']:
      backendOptions = retDictRessources['Value']

    # Search backends config in the component to update some options
    retDictConfig = gConfig.getOptionsDict(
        "%s/%s/%s" % (cfgPath, 'LogBackendsConfig', backend))
    if retDictConfig['OK']:
      backendOptions.update(retDictConfig['Value'])
    else:
      # Search backends config in the component with the old option
      # 'BackendsOptions'
      retDictOptions = gConfig.getOptionsDict("%s/BackendsOptions" % cfgPath)
      if retDictOptions['OK']:
        # We have to write the deprecated message with the print method because we are changing
        # the backends, so we can not be sure of the display using a log.
        print "WARNING: Use of a deprecated cfg section: BackendsOptions. Please replace it by BackendConfig."
        backendOptions.update(retDictOptions['Value'])

    return backendOptions
コード例 #2
0
    def __getBackendOptionsFromCFG(self, cfgPath, backend):
        """
    Get backend options from the configuration. 

    :params cfgPath: string of the configuration path
    :params backend: string representing a backend identifier: stdout, file, f04 
    """
        # We have to put the import lines here to avoid a dependancy loop
        from DIRAC import gConfig
        from DIRAC.ConfigurationSystem.Client.Helpers.Resources import getBackendConfig

        backendOptions = {}
        # Search backends config in the resources section
        retDictRessources = getBackendConfig(backend)
        if retDictRessources['OK']:
            backendOptions = retDictRessources['Value']

        # Search backends config in the component to update some options
        retDictConfig = gConfig.getOptionsDict(
            "%s/%s/%s" % (cfgPath, 'LogBackendsConfig', backend))
        if retDictConfig['OK']:
            backendOptions.update(retDictConfig['Value'])
        else:
            # Search backends config in the component with the old option 'BackendsOptions'
            retDictOptions = gConfig.getOptionsDict("%s/BackendsOptions" %
                                                    cfgPath)
            if retDictOptions['OK']:
                # We have to write the deprecated message with the print method because we are changing
                # the backends, so we can not be sure of the display using a log.
                print "WARNING: Use of a deprecated cfg section: BackendsOptions. Please replace it by BackendConfig."
                backendOptions.update(retDictOptions['Value'])

        return backendOptions
コード例 #3
0
ファイル: LoggingRoot.py プロジェクト: TaykYoku/DIRAC
    def __getBackendOptionsFromCFG(self, cfgPath, backend):
        """
        Get backend options from the configuration.

        :param cfgPath: configuration path
        :param backend: backend identifier: stdout, file, f04
        """
        # We have to put the import lines here to avoid a dependancy loop
        from DIRAC import gConfig
        from DIRAC.ConfigurationSystem.Client.Helpers.Resources import getBackendConfig

        backendOptions = {}
        # Search backends config in the resources section
        retDictRessources = getBackendConfig(backend)
        if retDictRessources["OK"]:
            backendOptions = retDictRessources["Value"]

        # Search backends config in the component to update some options
        retDictConfig = gConfig.getOptionsDict("%s/%s/%s" % (cfgPath, "LogBackendsConfig", backend))
        if retDictConfig["OK"]:
            backendOptions.update(retDictConfig["Value"])

        return backendOptions