Exemplo n.º 1
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.PolicyFileNotFound(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_rules)
Exemplo n.º 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.PolicyFileNotFound(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_rules)
Exemplo n.º 3
0
def init():
    """Init an instance of the Enforcer class."""

    global _ENFORCER
    if not _ENFORCER:
        _ENFORCER = policy.Enforcer()
        # NOTE: Method _get_policy_path in common.policy can not always locate
        # neutron policy file (when init() is called in tests),
        # so set it explicitly.
        _ENFORCER.policy_path = utils.find_config_file({}, cfg.CONF.policy_file)
        _ENFORCER.load_rules(True)
Exemplo n.º 4
0
def init():
    """Init an instance of the Enforcer class."""

    global _ENFORCER
    if not _ENFORCER:
        _ENFORCER = policy.Enforcer()
        # NOTE: Method _get_policy_path in common.policy can not always locate
        # neutron policy file (when init() is called in tests),
        # so set it explicitly.
        _ENFORCER.policy_path = utils.find_config_file({},
                                                       cfg.CONF.policy_file)
        _ENFORCER.load_rules(True)