policies/engine: add more verbosity
This commit is contained in:
parent
3f92d1c420
commit
7462d56182
|
@ -74,9 +74,10 @@ class PolicyEngine:
|
||||||
for binding in self._iter_bindings():
|
for binding in self._iter_bindings():
|
||||||
self._check_policy_type(binding.policy)
|
self._check_policy_type(binding.policy)
|
||||||
policy = binding.policy
|
policy = binding.policy
|
||||||
cached_policy = cache.get(cache_key(binding, self.request.user), None)
|
key = cache_key(binding, self.request.user)
|
||||||
|
cached_policy = cache.get(key, None)
|
||||||
if cached_policy and self.use_cache:
|
if cached_policy and self.use_cache:
|
||||||
LOGGER.debug("P_ENG: Taking result from cache", policy=policy)
|
LOGGER.debug("P_ENG: Taking result from cache", policy=policy, cache_key=key)
|
||||||
self.__cached_policies.append(cached_policy)
|
self.__cached_policies.append(cached_policy)
|
||||||
continue
|
continue
|
||||||
LOGGER.debug("P_ENG: Evaluating policy", policy=policy)
|
LOGGER.debug("P_ENG: Evaluating policy", policy=policy)
|
||||||
|
@ -103,7 +104,7 @@ class PolicyEngine:
|
||||||
x.result for x in self.__processes if x.result
|
x.result for x in self.__processes if x.result
|
||||||
]
|
]
|
||||||
for result in process_results + self.__cached_policies:
|
for result in process_results + self.__cached_policies:
|
||||||
LOGGER.debug("P_ENG: result", passing=result.passing)
|
LOGGER.debug("P_ENG: result", passing=result.passing, messages=result.messages)
|
||||||
if result.messages:
|
if result.messages:
|
||||||
messages += result.messages
|
messages += result.messages
|
||||||
if not result.passing:
|
if not result.passing:
|
||||||
|
|
Reference in New Issue