diff options
author | Zuul <zuul@review.opendev.org> | 2021-04-16 16:59:32 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2021-04-16 16:59:32 +0000 |
commit | 92eae81048b392f140e35e060e4c66195a08613e (patch) | |
tree | dfe312cb90dc5b2da4f761d593f03549a88a006f | |
parent | 092e6383105a15466720541d7e0ba0755940f273 (diff) | |
parent | b7489eb75a9bde1c1fd36e5e1e547bf60b7bc189 (diff) | |
download | oslo-policy-92eae81048b392f140e35e060e4c66195a08613e.tar.gz |
Merge "Add debug log in pick_default_policy_file"
-rw-r--r-- | oslo_policy/policy.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/oslo_policy/policy.py b/oslo_policy/policy.py index 913a28a..4491eca 100644 --- a/oslo_policy/policy.py +++ b/oslo_policy/policy.py @@ -371,15 +371,25 @@ def pick_default_policy_file(conf, fallback_to_json_file=True): new_default_policy_file = 'policy.yaml' old_default_policy_file = 'policy.json' + policy_file = None if ((conf.oslo_policy.policy_file == new_default_policy_file) and fallback_to_json_file): location = conf.get_location('policy_file', 'oslo_policy').location if conf.find_file(conf.oslo_policy.policy_file): - return conf.oslo_policy.policy_file + policy_file = conf.oslo_policy.policy_file elif location in [cfg.Locations.opt_default, cfg.Locations.set_default]: + LOG.debug('Searching old policy.json file.') if conf.find_file(old_default_policy_file): - return old_default_policy_file + policy_file = old_default_policy_file + if policy_file: + LOG.debug( + 'Picking default policy file: %s. Config location: %s', + policy_file, location) + return policy_file + LOG.debug( + 'No default policy file present, picking the configured ' + 'one: %s.', conf.oslo_policy.policy_file) # Return overridden policy file return conf.oslo_policy.policy_file |