예제 #1
0
파일: policy.py 프로젝트: LuizOz/quantum
def init():
    global _POLICY_PATH
    if not _POLICY_PATH:
        _POLICY_PATH = config.find_config_file({}, [], 'policy.json')
        if not _POLICY_PATH:
            raise exceptions.PolicyNotFound(path=FLAGS.policy_file)
    with open(_POLICY_PATH) as f:
        _set_brain(f.read())
예제 #2
0
def init():
    global _POLICY_PATH
    global _POLICY_CACHE
    if not _POLICY_PATH:
        _POLICY_PATH = utils.find_config_file({}, cfg.CONF.policy_file)
        if not _POLICY_PATH:
            raise exceptions.PolicyNotFound(path=cfg.CONF.policy_file)
    # pass _set_brain to read_cached_file so that the policy brain
    # is reset only if the file has changed
    utils.read_cached_file(_POLICY_PATH, _POLICY_CACHE, reload_func=_set_brain)