def _load_policy_file(self, path, force_reload, overwrite=True): reloaded, data = fileutils.read_cached_file(path, force_reload=force_reload) if reloaded or not self.rules or not overwrite: rules = Rules.load_json(data, self.default_rule) self.set_rules(rules, overwrite=overwrite, use_conf=True) LOG.debug("Reloaded policy file: %(path)s", {'path': path})
def _load_policy_file(self, path, force_reload, overwrite=True): reloaded, data = fileutils.read_cached_file( path, force_reload=force_reload) if reloaded or not self.rules: rules = Rules.load_json(data, self.default_rule) self.set_rules(rules, overwrite) LOG.debug("Rules successfully reloaded")
def _load_policy_file(self, path, force_reload, overwrite=True): reloaded, data = fileutils.read_cached_file(path, force_reload=force_reload) if reloaded or not self.rules: rules = Rules.load_json(data, self.default_rule) self.set_rules(rules, overwrite) LOG.debug("Rules successfully reloaded")
def _load_policy_file(self, path, force_reload, overwrite=True): reloaded, data = fileutils.read_cached_file( path, force_reload=force_reload) if reloaded or not self.rules or not overwrite: rules = Rules.load_json(data, self.default_rule) self.set_rules(rules, overwrite=overwrite, use_conf=True) LOG.debug("Reloaded policy file: %(path)s", {'path': path})
def load_rules(self, force_reload=False): """Loads policy_path's rules. Policy file is cached and will be reloaded if modified. :param force_reload: Whether to overwrite current rules. """ if force_reload: self.use_conf = force_reload if self.use_conf: if not self.policy_path: self.policy_path = self._get_policy_path() reloaded, data = fileutils.read_cached_file( self.policy_path, force_reload=force_reload) if reloaded or not self.rules: rules = Rules.load_json(data, self.default_rule) self.set_rules(rules) LOG.debug("Rules successfully reloaded")