示例#1
0
文件: policy.py 项目: vefimova/cinder
 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})
示例#2
0
文件: policy.py 项目: NicolasT/cinder
 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")
示例#3
0
 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")
示例#4
0
 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})
示例#5
0
    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")
示例#6
0
    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")