diff --git a/lower-constraints.txt b/lower-constraints.txt index 499fcbbc..6fae158d 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -24,12 +24,12 @@ netaddr==0.7.20 netifaces==0.10.4 os-client-config==1.28.0 os-testr==1.0.0 -oslo.config==5.2.0 -oslo.context==2.19.2 +oslo.config==6.8.0 +oslo.context==2.22.0 oslo.i18n==3.15.3 -oslo.policy==1.30.0 +oslo.policy==3.6.0 oslo.serialization==2.18.0 -oslo.utils==3.33.0 +oslo.utils==4.5.0 oslotest==3.2.0 pbr==2.0.0 PyMySQL==0.8.0 @@ -37,11 +37,11 @@ pyparsing==2.1.0 python-mimeparse==1.6.0 python-subunit==1.0.0 pytz==2013.6 -PyYAML==3.13 -requests==2.14.2 +PyYAML==5.1 +requests==2.20.0 requests-mock==1.2.0 requestsexceptions==1.2.0 -rfc3986==0.3.1 +rfc3986==1.2.0 simplejson==3.13.2 smmap==0.9.0 stestr==1.0.0 diff --git a/monasca_common/policy/policy_engine.py b/monasca_common/policy/policy_engine.py index 4d3a0fc4..61bbd2db 100644 --- a/monasca_common/policy/policy_engine.py +++ b/monasca_common/policy/policy_engine.py @@ -22,6 +22,7 @@ import sys import logging from oslo_config import cfg +from oslo_policy import opts from oslo_policy import policy from monasca_common.policy.i18n import _LW @@ -41,6 +42,13 @@ _ENFORCER = None saved_file_rules = [] +# TODO(gmann): Remove setting the default value of config policy_file +# once oslo_policy change the default value to 'policy.yaml'. +# https://github.com/openstack/oslo.policy/blob/a626ad12fe5a3abd49d70e3e5b95589d279ab578/oslo_policy/opts.py#L49 +DEFAULT_POLICY_FILE = 'policy.yaml' +opts.set_defaults(cfg.CONF, DEFAULT_POLICY_FILE) + + def reset(): """Reset Enforcer class.""" global _ENFORCER diff --git a/releasenotes/notes/deprecate-json-formatted-policy-file-dca87c0913f20f09.yaml b/releasenotes/notes/deprecate-json-formatted-policy-file-dca87c0913f20f09.yaml new file mode 100644 index 00000000..c9c53000 --- /dev/null +++ b/releasenotes/notes/deprecate-json-formatted-policy-file-dca87c0913f20f09.yaml @@ -0,0 +1,20 @@ +--- +upgrade: + - | + The default value of ``[oslo_policy] policy_file`` config option has + been changed from ``policy.json`` to ``policy.yaml``. + Operators who are utilizing customized or previously generated + static policy JSON files (which are not needed by default), should + generate new policy files or convert them in YAML format. Use the + `oslopolicy-convert-json-to-yaml + `_ + tool to convert a JSON to YAML formatted policy file in + backward compatible way. +deprecations: + - | + Use of JSON policy files was deprecated by the ``oslo.policy`` library + during the Victoria development cycle. As a result, this deprecation is + being noted in the Wallaby cycle with an anticipated future removal of support + by ``oslo.policy``. As such operators will need to convert to YAML policy + files. Please see the upgrade notes for details on migration of any + custom policy files. diff --git a/requirements.txt b/requirements.txt index 0d95e568..fdc60ed0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,8 +3,8 @@ # process, which may cause wedges in the gate later. kazoo>=2.8.0 # Apache-2.0 PyMySQL>=0.8.0 # MIT License -oslo.config>=5.2.0 # Apache-2.0 -oslo.policy>=1.30.0 # Apache-2.0 +oslo.config>=6.8.0 # Apache-2.0 +oslo.policy>=3.6.0 # Apache-2.0 pbr!=2.1.0,>=2.0.0 # Apache-2.0 pyparsing>=2.1.0 # MIT simplejson>=3.13.2 # MIT diff --git a/test-requirements.txt b/test-requirements.txt index 435462a0..2940b864 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -8,7 +8,7 @@ Babel!=2.4.0,>=2.3.4 # BSD coverage!=4.4,>=4.0 # Apache-2.0 fixtures>=3.0.0 # Apache-2.0/BSD httplib2>=0.9.1 # MIT -oslo.context>=2.19.2 # Apache-2.0 +oslo.context>=2.22.0 # Apache-2.0 oslotest>=3.2.0 # Apache-2.0 stestr>=1.0.0 # Apache-2.0 requests-mock>=1.2.0 # Apache-2.0