def init(): global _POLICY_PATH global _POLICY_CACHE if not _POLICY_PATH: _POLICY_PATH = CONF.policy_file if not os.path.exists(_POLICY_PATH): _POLICY_PATH = CONF.find_file(_POLICY_PATH) if not _POLICY_PATH: raise exception.ConfigNotFound(path=CONF.policy_file) utils.read_cached_file(_POLICY_PATH, _POLICY_CACHE, reload_func=_set_rules)
def __init__(self, config_path=None): """Initialize the loader, and attempt to find the config. :param config_path: Full or relative path to the paste config. :returns: None """ config_path = config_path or CONF.api_paste_config if os.path.exists(config_path): self.config_path = config_path else: self.config_path = CONF.find_file(config_path) if not self.config_path: raise exception.ConfigNotFound(path=config_path)
def __init__(self, config_path=None): """Initialize the loader, and attempt to find the config. :param config_path: Full or relative path to the paste config. :returns: None """ self.config_path = None #import pdb #pdb.set_trace() config_path = config_path or CONF.wsgi.api_paste_config if not os.path.isabs(config_path): self.config_path = CONF.find_file(config_path) elif os.path.exists(config_path): self.config_path = config_path if not self.config_path: raise exception.ConfigNotFound(path=config_path)
def find_config(config_path): """Find a configuration file using the given hint. :param config_path: Full or relative path to the config. :returns: Full path of the config, if it exists. :raises: `nova.exception.ConfigNotFound` """ possible_locations = [ config_path, os.path.join(FLAGS.state_path, "etc", "nova", config_path), os.path.join(FLAGS.state_path, "etc", config_path), os.path.join(FLAGS.state_path, config_path), "/etc/nova/%s" % config_path, ] for path in possible_locations: if os.path.exists(path): return os.path.abspath(path) raise exception.ConfigNotFound(path=os.path.abspath(config_path))