Merge "Try loading all policy files even if some files are invalid"

This commit is contained in:
Zuul 2021-03-04 05:31:14 +00:00 committed by Gerrit Code Review
commit 065dfc72ac
1 changed files with 5 additions and 0 deletions

View File

@ -74,6 +74,11 @@ def _get_enforcer():
LOG.warning("Cannot load a policy file '%s' for service '%s' "
"due to IOError. One possible reason is "
"permission denied.", policy_file, service)
except ValueError:
LOG.warning("Cannot load a policy file '%s' for service '%s' "
"due to ValueError. The file might be wrongly "
"formatted.", policy_file, service)
# Ensure enforcer.rules is populated.
if enforcer.rules:
LOG.debug("adding enforcer for service: %s", service)