コード例 #1
0
    def create(cls, conf=None, options=None, args=None):
        app_name = "quantum"
        if not conf:
            conf_file, conf = config.load_paste_config(app_name, options, args)
            if not conf:
                message = (_('No paste configuration found for: %s'), app_name)
                raise exception.Error(message)

        # Setup logging early, supplying both the CLI options and the
        # configuration mapping from the config file
        # We only update the conf dict for the verbose and debug
        # flags. Everything else must be set up in the conf file...
        # Log the options used when starting if we're in debug mode...

        config.setup_logging(options, conf)
        debug = (options.get('debug') or config.get_option(
            conf, 'debug', type='bool', default=False))
        verbose = (options.get('verbose') or config.get_option(
            conf, 'verbose', type='bool', default=False))
        conf['debug'] = debug
        conf['verbose'] = verbose
        LOG.debug("*" * 80)
        LOG.debug("Configuration options gathered from config file:")
        LOG.debug(conf_file)
        LOG.debug("================================================")
        items = dict([(k, v) for k, v in conf.items()
                      if k not in ('__file__', 'here')])
        for key, value in sorted(items.items()):
            LOG.debug("%(key)-30s %(value)s" % {
                'key': key,
                'value': value,
            })
        LOG.debug("*" * 80)
        service = cls(app_name, conf_file, conf)
        return service
コード例 #2
0
ファイル: extensions.py プロジェクト: zhangheng1442/openstack
    def add_extension(self, ext):
        # Do nothing if the extension doesn't check out
        if not self._check_extension(ext):
            return

        alias = ext.get_alias()
        LOG.info(_('Loaded extension: %s'), alias)

        if alias in self.extensions:
            raise exceptions.Error(_("Found duplicate extension: %s") % alias)
        self.extensions[alias] = ext
コード例 #3
0
ファイル: utils.py プロジェクト: LuizOz/quantum
    def __get_backend(self):
        if not self.__backend:
            backend_name = self.__pivot.value
            if backend_name not in self.__backends:
                raise exception.Error('Invalid backend: %s' % backend_name)

            backend = self.__backends[backend_name]
            if isinstance(backend, tuple):
                name = backend[0]
                fromlist = backend[1]
            else:
                name = backend
                fromlist = backend

            self.__backend = __import__(name, None, None, fromlist)
            logging.info('backend %s', self.__backend)
        return self.__backend