[goal] Deprecate the JSON formatted policy file
As per the community goal of migrating the policy file the format from JSON to YAML[1], we need to do two things: 1. Change the default value of '[oslo_policy] policy_file'' config option from 'policy.json' to 'policy.yaml' with upgrade checks. 2. Deprecate the JSON formatted policy file on the project side via warning in doc and releasenotes. Also replace policy.json to policy.yaml ref from doc and tests. [1]https://governance.openstack.org/tc/goals/selected/wallaby/migrate-policy-format-from-json-to-yaml.html Change-Id: I1d74949c9d19ff543571382f887b5ed40756ecb9
This commit is contained in:
parent
956079ed25
commit
86765728bb
|
@ -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
|
||||
|
|
|
@ -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
|
||||
<https://docs.openstack.org/oslo.policy/latest/cli/oslopolicy-convert-json-to-yaml.html>`_
|
||||
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.
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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})),
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -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."""
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue