Try loading all policy files even if some files are invalid
This change ensures that horizon tries to load all policy files even
if an invalid policy file is found, so that horizon can use as many
policy rules as it can parse.
Closes-Bug:
@@ -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)
