Fix reference cycle caused by deprecated sample override
In the sample policy generator, we create a rule that maps the
deprecated name of a policy to the new rule name. For example:
identity:old_rule: rule:identity:new_rule
However, in the policy code, if we see an override of a deprecated
name and no override for the new name, we apply the value of the
deprecated name to the new name. In the above case, this results
in us creating a rule that looks like:
identity:new_rule: rule:identity:new_rule
which is a circular reference and nonsense.
To fix this, I added a check to the deprecated rule logic that looks
for instances where the old override is just a reference to the new
rule. If that's the case, then we don't need to do anything because
it's already doing the right thing.
Reviewed: https:/ /review. opendev. org/682150 /git.openstack. org/cgit/ openstack/ oslo.policy/ commit/ ?id=82a2c8d8b71 896b1f8b7f33c56 0681367ae76755
Committed: https:/
Submitter: Zuul
Branch: master
commit 82a2c8d8b71896b 1f8b7f33c560681 367ae76755
Author: Ben Nemec <email address hidden>
Date: Fri Sep 13 20:04:56 2019 +0000
Fix reference cycle caused by deprecated sample override
In the sample policy generator, we create a rule that maps the
deprecated name of a policy to the new rule name. For example:
identity: old_rule: rule:identity: new_rule
However, in the policy code, if we see an override of a deprecated
name and no override for the new name, we apply the value of the
deprecated name to the new name. In the above case, this results
in us creating a rule that looks like:
identity: new_rule: rule:identity: new_rule
which is a circular reference and nonsense.
To fix this, I added a check to the deprecated rule logic that looks
for instances where the old override is just a reference to the new
rule. If that's the case, then we don't need to do anything because
it's already doing the right thing.
Change-Id: Ifd14993bc84e83 c13abab3456fbf6 70c06e5806f
Closes-Bug: 1843931