Fix deprecated rule logic if the rule was deleted in policy directory.

The bug scenario:
- define deprecated rule in policy folder
- start a service
- enforce policies
- remove the rule in policy folder
- enforce policies

New default is applied to the rule,
but new and old defaults should be applied
(OR logic)
The patch fixes it.

Closes-Bug: 1977549
Change-Id: If11fe2da1163d6d3f16d133aeb207a055cf30de4
This commit is contained in:
Mitya_Eremeev 2022-06-06 13:17:51 +03:00 committed by mitya-eremeev-2
parent e7b9dd1f5a
commit d80573c612
1 changed files with 1 additions and 0 deletions

View File

@ -664,6 +664,7 @@ class Enforcer(object):
)
elif self.overwrite:
self.rules = Rules(default_rule=self.default_rule)
self.file_rules = {}
for path in existing_policy_dirs:
self._walk_through_policy_directory(
path, self._load_policy_file, True, False)