diff --git a/lower-constraints.txt b/lower-constraints.txt index 27bdf86bd..efa60f800 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -63,22 +63,22 @@ os-service-types==1.2.0 osc-lib==1.10.0 oslo.cache==1.29.0 oslo.concurrency==3.26.0 -oslo.config==5.2.0 -oslo.context==2.21.0 +oslo.config==6.8.0 +oslo.context==2.22.0 oslo.db==4.40.0 oslo.i18n==3.20.0 oslo.log==3.37.0 oslo.messaging==5.36.0 oslo.middleware==3.35.0 -oslo.policy==1.34.0 +oslo.policy==3.6.0 oslo.privsep==1.33.2 oslo.rootwrap==5.13.0 oslo.serialization==2.25.0 oslo.service==1.31.0 -oslo.upgradecheck==0.1.0 -oslo.utils==3.36.0 +oslo.upgradecheck==1.3.0 +oslo.utils==4.5.0 oslotest==3.3.0 -packaging==17.1 +packaging==20.4 Paste==2.0.3 PasteDeploy==1.5.2 pbr==3.1.1 @@ -107,11 +107,11 @@ python-subunit==1.2.0 python-swiftclient==3.5.0 python-zaqarclient==1.9.0 pytz==2018.3 -PyYAML==3.13 +PyYAML==5.1 repoze.lru==0.7 requests==2.18.4 requestsexceptions==1.4.0 -rfc3986==1.1.0 +rfc3986==1.2.0 Routes==2.4.1 simplegeneric==0.8.1 simplejson==3.13.2 diff --git a/releasenotes/notes/deprecate-json-formatted-policy-file-23144ea954ae3b4a.yaml b/releasenotes/notes/deprecate-json-formatted-policy-file-23144ea954ae3b4a.yaml new file mode 100644 index 000000000..c9c530004 --- /dev/null +++ b/releasenotes/notes/deprecate-json-formatted-policy-file-23144ea954ae3b4a.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 d628dd1b4..906a3faff 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,18 +9,18 @@ httplib2>=0.10.3 # MIT iso8601>=0.1.12 # MIT kombu>=4.3.0 # BSD netaddr>=0.7.20 # BSD -oslo.config>=5.2.0 # Apache-2.0 -oslo.context>=2.21.0 # Apache-2.0 +oslo.config>=6.8.0 # Apache-2.0 +oslo.context>=2.22.0 # Apache-2.0 oslo.db>=4.40.0 # Apache-2.0 oslo.messaging>=5.36.0 # Apache-2.0 oslo.middleware>=3.35.0 # Apache-2.0 oslo.serialization>=2.25.0 # Apache-2.0 oslo.service>=1.31.0 # Apache-2.0 -oslo.upgradecheck>=0.1.0 # Apache-2.0 -oslo.utils>=3.36.0 # Apache-2.0 +oslo.upgradecheck>=1.3.0 # Apache-2.0 +oslo.utils>=4.5.0 # Apache-2.0 oslo.log>=3.37.0 # Apache-2.0 oslo.rootwrap>=5.13.0 # Apache-2.0 -oslo.policy>=1.34.0 # Apache-2.0 +oslo.policy>=3.6.0 # Apache-2.0 oslo.privsep>=1.33.2 # Apache-2.0 pbr>=3.1.1 # Apache-2.0 pecan>=1.3.2 # BSD diff --git a/setup.cfg b/setup.cfg index 36fc2e7b8..262f249fd 100644 --- a/setup.cfg +++ b/setup.cfg @@ -66,7 +66,7 @@ oslo.config.opts = solum.worker.config = solum.worker.config:list_opts oslo.config.opts.defaults = - solum.api.app = solum.common.config:set_cors_middleware_defaults + solum.api.app = solum.common.config:set_config_defaults oslo.policy.policies = solum = solum.common.policies:list_rules diff --git a/solum/cmd/status.py b/solum/cmd/status.py index 2fc8c1957..0694f48cc 100644 --- a/solum/cmd/status.py +++ b/solum/cmd/status.py @@ -15,6 +15,7 @@ import sys from oslo_config import cfg +from oslo_upgradecheck import common_checks from oslo_upgradecheck import upgradecheck from solum.i18n import _ @@ -28,11 +29,6 @@ class Checks(upgradecheck.UpgradeCommands): and added to _upgrade_checks tuple. """ - def _check_placeholder(self): - # This is just a placeholder for upgrade checks, it should be - # removed when the actual checks are added - return upgradecheck.Result(upgradecheck.Code.SUCCESS) - # The format of the check functions is to return an # oslo_upgradecheck.upgradecheck.Result # object with the appropriate @@ -42,7 +38,8 @@ class Checks(upgradecheck.UpgradeCommands): # summary will be rolled up at the end of the check() method. _upgrade_checks = ( # In the future there should be some real checks added here - (_('Placeholder'), _check_placeholder), + (_('Policy File JSON to YAML Migration'), + (common_checks.check_policy_json, {'conf': cfg.CONF})), ) diff --git a/solum/common/config.py b/solum/common/config.py index f982a727d..5a7cebeb2 100644 --- a/solum/common/config.py +++ b/solum/common/config.py @@ -15,12 +15,18 @@ from oslo_config import cfg from oslo_middleware import cors +from oslo_policy import opts def set_config_defaults(): """This method updates all configuration default values.""" set_cors_middleware_defaults() + # 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 + opts.set_defaults(cfg.CONF, 'policy.yaml') + def set_cors_middleware_defaults(): """Update default configuration options for oslo.middleware.""" diff --git a/solum/common/policy.py b/solum/common/policy.py index 3ea36b8ec..723dde9dd 100644 --- a/solum/common/policy.py +++ b/solum/common/policy.py @@ -14,6 +14,7 @@ from oslo_config import cfg from oslo_log import log as logging +from oslo_policy import opts from oslo_policy import policy from webob import exc as exceptions @@ -23,6 +24,12 @@ LOG = logging.getLogger(__name__) CONF = cfg.CONF +# 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(CONF, DEFAULT_POLICY_FILE) + _ENFORCER = None diff --git a/solum/tests/cmd/test_status.py b/solum/tests/cmd/test_status.py index 47bf22063..cda529bc9 100644 --- a/solum/tests/cmd/test_status.py +++ b/solum/tests/cmd/test_status.py @@ -15,6 +15,7 @@ from oslo_upgradecheck.upgradecheck import Code from solum.cmd import status +from solum import config from solum.tests import base @@ -22,9 +23,14 @@ class TestUpgradeChecks(base.BaseTestCase): def setUp(self): super(TestUpgradeChecks, self).setUp() + config.parse_args(argv=[]) self.cmd = status.Checks() - def test__check_placeholder(self): - check_result = self.cmd._check_placeholder() - self.assertEqual( - Code.SUCCESS, check_result.code) + def test_checks(self): + for name, func in self.cmd._upgrade_checks: + if isinstance(func, tuple): + func_name, kwargs = func + result = func_name(self, **kwargs) + else: + result = func(self) + self.assertEqual(Code.SUCCESS, result.code)