Example #1
1
 def geturl(self):
     """
     Get the broker URL
     @return: The broker URL
     @rtype: str
     """
     main = Config()
     cfg = self.cfg()
     return nvl(cfg.messaging.url,
            nvl(main.messaging.url))
Example #2
0
File: main.py Project: splice/gofer
 def __init__(self, plugins):
     """
     @param plugins: A list of loaded plugins
     @type plugins: list
     """
     self.plugins = plugins
     PAM.SERVICE = nvl(cfg.pam.service, PAM.SERVICE)
Example #3
0
 def getbroker(self):
     """
     Get the amqp broker for this plugin.  Each plugin can
     connect to a different broker.
     @return: The broker if configured.
     @rtype: L{Broker}
     """
     cfg = self.cfg()
     main = Config()
     broker = Broker(self.geturl())
     broker.cacert = \
         nvl(cfg.messaging.cacert,
         nvl(main.messaging.cacert))
     broker.clientcert = \
         nvl(cfg.messaging.clientcert,
         nvl(main.messaging.clientcert))
     log.info('broker (qpid) configured: %s', broker)
     return broker
Example #4
0
 def enabled(self):
     """
     Get whether the plugin is enabled.
     @return: True if enabled.
     @rtype: bool
     """
     cfg = self.cfg()
     try:
         return int(nvl(cfg.main.enabled, 0))
     except:
         return 0
Example #5
0
 def __requires(self):
     """
     Get the list of declared required plugins.
     @return: A list of plugin names.
     @rtype: list
     """
     required = []
     declared = nvl(self.main.requires)
     if declared:
         plugins =  declared.split(',')
         required = [s.strip() for s in plugins]
     return tuple(required)
Example #6
0
 def getuuid(self):
     """
     Get the plugin's messaging UUID.
     @return: The plugin's messaging UUID.
     @rtype: str
     """
     self.__lock()
     try:
         cfg = self.cfg()
         return nvl(cfg.messaging.uuid)
     finally:
         self.__unlock()
Example #7
0
File: main.py Project: splice/gofer
def setupLogging():
    """
    Set logging levels based on configuration.
    """
    for p in nvl(cfg.logging, []):
        level = cfg.logging[p]
        if not level:
            continue
        try:
            L = getattr(logging, level.upper())
            logger = logging.getLogger(p)
            logger.setLevel(L)
        except:
            pass
Example #8
0
File: main.py Project: splice/gofer
def eager():
    return int(nvl(cfg.loader.eager, 0))
Example #9
-1
 def nthreads(self):
     """
     Get the number of theads in the plugin's pool.
     @return: number of theads.
     @rtype: int
     """
     main = Config()
     cfg = self.cfg()
     value = \
         nvl(cfg.messaging.threads,
         nvl(main.messaging.threads, 1))
     value = int(value)
     assert(value >= 1)
     return value