Hello community, here is the log from the commit of package python-oslo.policy for openSUSE:Factory checked in at 2020-02-18 10:41:30 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-oslo.policy (Old) and /work/SRC/openSUSE:Factory/.python-oslo.policy.new.26092 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-oslo.policy" Tue Feb 18 10:41:30 2020 rev:11 rq:774917 version:2.3.2 Changes: -------- --- /work/SRC/openSUSE:Factory/python-oslo.policy/python-oslo.policy.changes 2019-05-03 22:42:32.791256618 +0200 +++ /work/SRC/openSUSE:Factory/.python-oslo.policy.new.26092/python-oslo.policy.changes 2020-02-18 10:41:45.825110794 +0100 @@ -1,0 +2,20 @@ +Wed Oct 9 12:27:45 UTC 2019 - [email protected] + +- update to version 2.3.2 + - Dropping the py35 testing + - Add Python 3 Train unit tests + - Clarify policy_file configuration option help text + - Corrects tox.ini snippet to point to config file + - Replace git.openstack.org URLs with opendev.org URLs + - Add attribute to suppress deprecation warnings + - Add unit tests on the sphinxext indent function + - Cap Bandit below 1.6.0 and update Sphinx requirement + - Updated from global requirements + - Add py36 and py37 tox envs + - Only alias when policy names change + - Move doc related modules to doc/requirements.txt + - Provide more specific error when namespace is missing + - OpenDev Migration Patch + - Update master for stable/stein + +------------------------------------------------------------------- Old: ---- oslo.policy-2.1.1.tar.gz New: ---- oslo.policy-2.3.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-oslo.policy.spec ++++++ --- /var/tmp/diff_new_pack.bRRRjg/_old 2020-02-18 10:41:46.573112319 +0100 +++ /var/tmp/diff_new_pack.bRRRjg/_new 2020-02-18 10:41:46.577112328 +0100 @@ -17,15 +17,14 @@ Name: python-oslo.policy -Version: 2.1.1 +Version: 2.3.2 Release: 0 Summary: OpenStack Oslo Policy library License: Apache-2.0 Group: Development/Languages/Python URL: https://launchpad.net/oslo.policy -Source0: https://files.pythonhosted.org/packages/source/o/oslo.policy/oslo.policy-2.1.1.tar.gz +Source0: https://files.pythonhosted.org/packages/source/o/oslo.policy/oslo.policy-2.3.2.tar.gz BuildRequires: openstack-macros -BuildRequires: python-devel BuildRequires: python2-PyYAML >= 3.12 BuildRequires: python2-oslo.config >= 5.2.0 BuildRequires: python2-oslo.context >= 2.22.0 @@ -37,7 +36,6 @@ BuildRequires: python2-requests-mock BuildRequires: python2-stestr BuildRequires: python3-PyYAML >= 3.12 -BuildRequires: python3-devel BuildRequires: python3-oslo.config >= 5.2.0 BuildRequires: python3-oslo.context >= 2.22.0 BuildRequires: python3-oslo.i18n >= 3.15.3 @@ -74,22 +72,22 @@ Summary: Documentation for the Oslo Policy library Group: Documentation/HTML BuildRequires: python2-Sphinx -BuildRequires: python2-openstackdocstheme BuildRequires: python3-Sphinx BuildRequires: python3-openstackdocstheme +BuildRequires: python3-sphinxcontrib-apidoc %description -n python-oslo.policy-doc Documentation for the Oslo Policy library. %prep -%autosetup -p1 -n oslo.policy-2.1.1 +%autosetup -p1 -n oslo.policy-2.3.2 %py_req_cleanup %build %{python_build} # generate html docs -%{__python2} setup.py build_sphinx +PBR_VERSION=%{version} %sphinx_build -b html doc/source doc/build/html # remove the sphinx-build leftovers rm -rf doc/build/html/.{doctrees,buildinfo} ++++++ _service ++++++ --- /var/tmp/diff_new_pack.bRRRjg/_old 2020-02-18 10:41:46.609112393 +0100 +++ /var/tmp/diff_new_pack.bRRRjg/_new 2020-02-18 10:41:46.609112393 +0100 @@ -1,8 +1,8 @@ <services> <service mode="disabled" name="renderspec"> - <param name="input-template">https://raw.githubusercontent.com/openstack/rpm-packaging/stable/stein/openstack/oslo.policy/oslo.policy.spec.j2</param> + <param name="input-template">https://raw.githubusercontent.com/openstack/rpm-packaging/stable/train/openstack/oslo.policy/oslo.policy.spec.j2</param> <param name="output-name">python-oslo.policy.spec</param> - <param name="requirements">https://raw.githubusercontent.com/openstack/oslo.policy/stable/stein/requirements.txt</param> + <param name="requirements">https://raw.githubusercontent.com/openstack/oslo.policy/stable/train/requirements.txt</param> <param name="changelog-email">[email protected]</param> <param name="changelog-provider">gh,openstack,oslo.policy</param> </service> ++++++ oslo.policy-2.1.1.tar.gz -> oslo.policy-2.3.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.policy-2.1.1/.zuul.yaml new/oslo.policy-2.3.2/.zuul.yaml --- old/oslo.policy-2.1.1/.zuul.yaml 2019-02-28 19:04:10.000000000 +0100 +++ new/oslo.policy-2.3.2/.zuul.yaml 2019-09-12 18:37:51.000000000 +0200 @@ -5,9 +5,7 @@ - lib-forward-testing-python3 - openstack-lower-constraints-jobs - openstack-python-jobs - - openstack-python35-jobs - - openstack-python36-jobs - - openstack-python37-jobs + - openstack-python3-train-jobs - periodic-stable-jobs - publish-openstack-docs-pti - release-notes-jobs-python3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.policy-2.1.1/AUTHORS new/oslo.policy-2.3.2/AUTHORS --- old/oslo.policy-2.1.1/AUTHORS 2019-02-28 19:07:49.000000000 +0100 +++ new/oslo.policy-2.3.2/AUTHORS 2019-09-12 18:38:29.000000000 +0200 @@ -18,6 +18,8 @@ Chang Bo Guo <[email protected]> ChangBo Guo(gcb) <[email protected]> Chuck Short <[email protected]> +Colleen Murphy <[email protected]> +Corey Bryant <[email protected]> Corey Wright <[email protected]> Daisuke Fujita <[email protected]> Davanum Srinivas <[email protected]> @@ -33,9 +35,11 @@ Flavio Percoco <[email protected]> Florent Flament <[email protected]> Gary Kotton <[email protected]> +Ghanshyam Mann <[email protected]> Haiwei Xu <[email protected]> He Jie Xu <[email protected]> He Jie Xu <[email protected]> +Hervé Beraud <[email protected]> Ian Cordasco <[email protected]> Ian Cordasco <[email protected]> Ian Wienand <[email protected]> @@ -96,11 +100,14 @@ ZhijunWei <[email protected]> ZhongShengping <[email protected]> Zhongyue Luo <[email protected]> +caoyuan <[email protected]> fujioka yuuichi <[email protected]> gecong1973 <[email protected]> gengchc2 <[email protected]> guohliu <[email protected]> howardlee <[email protected]> +jacky06 <[email protected]> +jessegler <[email protected]> loooosy <[email protected]> melissaml <[email protected]> ricolin <[email protected]> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.policy-2.1.1/ChangeLog new/oslo.policy-2.3.2/ChangeLog --- old/oslo.policy-2.1.1/ChangeLog 2019-02-28 19:07:49.000000000 +0100 +++ new/oslo.policy-2.3.2/ChangeLog 2019-09-12 18:38:28.000000000 +0200 @@ -1,6 +1,37 @@ CHANGES ======= +2.3.2 +----- + + +2.3.1 +----- + + +2.3.0 +----- + +* Add attribute to suppress deprecation warnings +* Only alias when policy names change +* Add unit tests on the sphinxext indent function +* Move doc related modules to doc/requirements.txt +* Add Python 3 Train unit tests +* Updated from global requirements +* Replace git.openstack.org URLs with opendev.org URLs +* Cap Bandit below 1.6.0 and update Sphinx requirement + +2.2.0 +----- + +* OpenDev Migration Patch +* Dropping the py35 testing +* Clarify policy\_file configuration option help text +* Update master for stable/stein +* Corrects tox.ini snippet to point to config file +* Provide more specific error when namespace is missing +* Add py36 and py37 tox envs + 2.1.1 ----- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.policy-2.1.1/PKG-INFO new/oslo.policy-2.3.2/PKG-INFO --- old/oslo.policy-2.1.1/PKG-INFO 2019-02-28 19:07:49.000000000 +0100 +++ new/oslo.policy-2.3.2/PKG-INFO 2019-09-12 18:38:29.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: oslo.policy -Version: 2.1.1 +Version: 2.3.2 Summary: Oslo Policy library Home-page: https://docs.openstack.org/oslo.policy/latest/ Author: OpenStack @@ -28,7 +28,7 @@ * Free software: Apache license * Documentation: https://docs.openstack.org/oslo.policy/latest/ - * Source: https://git.openstack.org/cgit/openstack/oslo.policy + * Source: https://opendev.org/openstack/oslo.policy * Bugs: https://bugs.launchpad.net/oslo.policy * Blueprints: https://blueprints.launchpad.net/oslo.policy * Release Notes: https://docs.openstack.org/releasenotes/oslo.policy @@ -44,4 +44,5 @@ Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.policy-2.1.1/README.rst new/oslo.policy-2.3.2/README.rst --- old/oslo.policy-2.1.1/README.rst 2019-02-28 19:04:10.000000000 +0100 +++ new/oslo.policy-2.3.2/README.rst 2019-09-12 18:37:51.000000000 +0200 @@ -20,7 +20,7 @@ * Free software: Apache license * Documentation: https://docs.openstack.org/oslo.policy/latest/ -* Source: https://git.openstack.org/cgit/openstack/oslo.policy +* Source: https://opendev.org/openstack/oslo.policy * Bugs: https://bugs.launchpad.net/oslo.policy * Blueprints: https://blueprints.launchpad.net/oslo.policy * Release Notes: https://docs.openstack.org/releasenotes/oslo.policy diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.policy-2.1.1/doc/requirements.txt new/oslo.policy-2.3.2/doc/requirements.txt --- old/oslo.policy-2.1.1/doc/requirements.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/oslo.policy-2.3.2/doc/requirements.txt 2019-09-12 18:37:51.000000000 +0200 @@ -0,0 +1,10 @@ +# The order of packages is significant, because pip processes them in the order +# of appearance. Changing the order has an impact on the overall integration +# process, which may cause wedges in the gate later. + +openstackdocstheme>=1.18.1 # Apache-2.0 +sphinx!=1.6.6,!=1.6.7,>=1.6.5,<2.0.0;python_version=='2.7' # BSD +sphinx!=1.6.6,!=1.6.7,>=1.6.5;python_version>='3.4' # BSD +sphinxcontrib-apidoc>=0.2.0 # BSD + +reno>=2.5.0 # Apache-2.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.policy-2.1.1/doc/source/conf.py new/oslo.policy-2.3.2/doc/source/conf.py --- old/oslo.policy-2.1.1/doc/source/conf.py 2019-02-28 19:04:10.000000000 +0100 +++ new/oslo.policy-2.3.2/doc/source/conf.py 2019-09-12 18:37:51.000000000 +0200 @@ -23,6 +23,7 @@ extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.extlinks', + 'sphinxcontrib.apidoc', #'sphinx.ext.intersphinx', 'openstackdocstheme', 'oslo_config.sphinxext', @@ -51,7 +52,7 @@ # General information about the project. project = u'oslo.policy' copyright = u'2014, OpenStack Foundation' -source_tree = 'https://git.openstack.org/cgit/openstack/oslo.policy/tree' +source_tree = 'https://opendev.org/openstack/oslo.policy/src/branch/master' # If true, '()' will be appended to :func: etc. cross-reference text. add_function_parentheses = True @@ -95,3 +96,7 @@ # Example configuration for intersphinx: refer to the Python standard library. #intersphinx_mapping = {'http://docs.python.org/': None} + +# -- sphinxcontrib.apidoc configuration -------------------------------------- +apidoc_module_dir = '../../oslo_policy' +apidoc_output_dir = 'reference/api' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.policy-2.1.1/doc/source/reference/index.rst new/oslo.policy-2.3.2/doc/source/reference/index.rst --- old/oslo.policy-2.1.1/doc/source/reference/index.rst 2019-02-28 19:04:10.000000000 +0100 +++ new/oslo.policy-2.3.2/doc/source/reference/index.rst 2019-09-12 18:37:51.000000000 +0200 @@ -4,5 +4,5 @@ .. toctree:: - api/autoindex + api/modules diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.policy-2.1.1/doc/source/user/usage.rst new/oslo.policy-2.3.2/doc/source/user/usage.rst --- old/oslo.policy-2.1.1/doc/source/user/usage.rst 2019-02-28 19:04:10.000000000 +0100 +++ new/oslo.policy-2.3.2/doc/source/user/usage.rst 2019-09-12 18:37:51.000000000 +0200 @@ -83,7 +83,7 @@ environment for generating sample configuration files in ``tox.ini``:: [testenv:genpolicy] - commands = oslopolicy-sample-generator --config-file etc/foo/policy.yaml.sample + commands = oslopolicy-sample-generator --config-file etc/foo/foo-policy-generator.conf Changes to Enforcer Initialization ---------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.policy-2.1.1/lower-constraints.txt new/oslo.policy-2.3.2/lower-constraints.txt --- old/oslo.policy-2.1.1/lower-constraints.txt 2019-02-28 19:04:10.000000000 +0100 +++ new/oslo.policy-2.3.2/lower-constraints.txt 2019-09-12 18:37:51.000000000 +0200 @@ -44,7 +44,7 @@ PyYAML==3.12 reno==2.5.0 requests==2.14.2 -requests-mock==1.1.0 +requests-mock==1.2.0 requestsexceptions==1.2.0 rfc3986==0.3.1 six==1.10.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.policy-2.1.1/oslo.policy.egg-info/PKG-INFO new/oslo.policy-2.3.2/oslo.policy.egg-info/PKG-INFO --- old/oslo.policy-2.1.1/oslo.policy.egg-info/PKG-INFO 2019-02-28 19:07:49.000000000 +0100 +++ new/oslo.policy-2.3.2/oslo.policy.egg-info/PKG-INFO 2019-09-12 18:38:29.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: oslo.policy -Version: 2.1.1 +Version: 2.3.2 Summary: Oslo Policy library Home-page: https://docs.openstack.org/oslo.policy/latest/ Author: OpenStack @@ -28,7 +28,7 @@ * Free software: Apache license * Documentation: https://docs.openstack.org/oslo.policy/latest/ - * Source: https://git.openstack.org/cgit/openstack/oslo.policy + * Source: https://opendev.org/openstack/oslo.policy * Bugs: https://bugs.launchpad.net/oslo.policy * Blueprints: https://blueprints.launchpad.net/oslo.policy * Release Notes: https://docs.openstack.org/releasenotes/oslo.policy @@ -44,4 +44,5 @@ Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.policy-2.1.1/oslo.policy.egg-info/SOURCES.txt new/oslo.policy-2.3.2/oslo.policy.egg-info/SOURCES.txt --- old/oslo.policy-2.1.1/oslo.policy.egg-info/SOURCES.txt 2019-02-28 19:07:49.000000000 +0100 +++ new/oslo.policy-2.3.2/oslo.policy.egg-info/SOURCES.txt 2019-09-12 18:38:29.000000000 +0200 @@ -15,6 +15,7 @@ setup.py test-requirements.txt tox.ini +doc/requirements.txt doc/source/conf.py doc/source/index.rst doc/source/admin/index.rst @@ -85,6 +86,7 @@ releasenotes/source/pike.rst releasenotes/source/queens.rst releasenotes/source/rocky.rst +releasenotes/source/stein.rst releasenotes/source/unreleased.rst releasenotes/source/_static/.placeholder releasenotes/source/_templates/.placeholder diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.policy-2.1.1/oslo.policy.egg-info/pbr.json new/oslo.policy-2.3.2/oslo.policy.egg-info/pbr.json --- old/oslo.policy-2.1.1/oslo.policy.egg-info/pbr.json 2019-02-28 19:07:49.000000000 +0100 +++ new/oslo.policy-2.3.2/oslo.policy.egg-info/pbr.json 2019-09-12 18:38:29.000000000 +0200 @@ -1 +1 @@ -{"git_version": "106a86d", "is_release": true} \ No newline at end of file +{"git_version": "e433a3c", "is_release": true} \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.policy-2.1.1/oslo_policy/generator.py new/oslo.policy-2.3.2/oslo_policy/generator.py --- old/oslo.policy-2.1.1/oslo_policy/generator.py 2019-02-28 19:04:18.000000000 +0100 +++ new/oslo.policy-2.3.2/oslo_policy/generator.py 2019-09-12 18:37:51.000000000 +0200 @@ -84,6 +84,8 @@ names=[namespace], on_load_failure_callback=on_load_failure_callback, invoke_on_load=True) + if namespace not in mgr: + raise KeyError('Namespace "%s" not found.' % namespace) enforcer = mgr[namespace].obj return enforcer @@ -191,12 +193,19 @@ 'check_str': default.check_str, 'reason': default.deprecated_reason} - text = ( - '%(text)s%(deprecated_text)s\n"%(old_name)s": "rule:%(name)s"\n' - ) % {'text': text, - 'deprecated_text': _format_help_text(deprecated_text), - 'old_name': default.deprecated_rule.name, - 'name': default.name} + if default.name != default.deprecated_rule.name: + text = ( + '%(text)s%(deprecated_text)s\n"%(old_name)s": "rule:%(name)s"' + '\n' + ) % {'text': text, + 'deprecated_text': _format_help_text(deprecated_text), + 'old_name': default.deprecated_rule.name, + 'name': default.name} + else: + text = ( + '%(text)s%(deprecated_text)s\n' + ) % {'text': text, + 'deprecated_text': _format_help_text(deprecated_text)} return text diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.policy-2.1.1/oslo_policy/opts.py new/oslo.policy-2.3.2/oslo_policy/opts.py --- old/oslo.policy-2.1.1/oslo_policy/opts.py 2019-02-28 19:04:10.000000000 +0100 +++ new/oslo.policy-2.3.2/oslo_policy/opts.py 2019-09-12 18:37:51.000000000 +0200 @@ -36,7 +36,10 @@ 'invoked with mismatching scope.')), cfg.StrOpt('policy_file', default='policy.json', - help=_('The file that defines policies.'), + help=_('The relative or absolute path of a file that maps ' + 'roles to permissions for a given service. Relative ' + 'paths must be specified in relation to the ' + 'configuration file setting this option.'), deprecated_group='DEFAULT'), cfg.StrOpt('policy_default_rule', default='default', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.policy-2.1.1/oslo_policy/policy.py new/oslo.policy-2.3.2/oslo_policy/policy.py --- old/oslo.policy-2.1.1/oslo_policy/policy.py 2019-02-28 19:04:10.000000000 +0100 +++ new/oslo.policy-2.3.2/oslo_policy/policy.py 2019-09-12 18:37:51.000000000 +0200 @@ -503,6 +503,8 @@ self._policy_dir_mtimes = {} self._file_cache = {} self._informed_no_policy_file = False + # FOR TESTING ONLY + self.suppress_deprecation_warnings = False def set_rules(self, rules, overwrite=True, use_conf=False): """Create a new :class:`Rules` based on the provided dict of rules. @@ -538,6 +540,7 @@ self.registered_rules = {} self.file_rules = {} self._informed_no_policy_file = False + self.suppress_deprecation_warnings = False def load_rules(self, force_reload=False): """Loads policy_path's rules. @@ -618,7 +621,8 @@ # know that the policy is going to be silently ignored in the future # and they can remove it from their overrides since it isn't being # replaced by another policy. - if default.name in self.file_rules: + if not self.suppress_deprecation_warnings and \ + default.name in self.file_rules: warnings.warn( 'Policy "%(policy)s":"%(check_str)s" was deprecated for ' 'removal in %(release)s. Reason: %(reason)s. Its value may be ' @@ -662,7 +666,8 @@ if deprecated_rule.name != default.name and ( deprecated_rule.name in self.file_rules): - warnings.warn(deprecated_msg) + if not self.suppress_deprecation_warnings: + warnings.warn(deprecated_msg) # If the deprecated policy is being overridden and doesn't match # the default deprecated policy, override the new policy's default @@ -692,7 +697,8 @@ default.check_str + ' or ' + deprecated_rule.check_str ) - warnings.warn(deprecated_msg) + if not self.suppress_deprecation_warnings: + warnings.warn(deprecated_msg) def _undefined_check(self, check): '''Check if a RuleCheck references an undefined rule.''' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.policy-2.1.1/oslo_policy/tests/test_generator.py new/oslo.policy-2.3.2/oslo_policy/tests/test_generator.py --- old/oslo.policy-2.1.1/oslo_policy/tests/test_generator.py 2019-02-28 19:04:18.000000000 +0100 +++ new/oslo.policy-2.3.2/oslo_policy/tests/test_generator.py 2019-09-12 18:37:51.000000000 +0200 @@ -239,6 +239,49 @@ ) self.assertEqual(expected, stdout.getvalue()) + def test_deprecated_policies_with_same_name(self): + deprecated_rule = policy.DeprecatedRule( + name='foo:create_bar', + check_str='role:old' + ) + new_rule = policy.RuleDefault( + name='foo:create_bar', + check_str='role:fizz', + description='Create a bar.', + deprecated_rule=deprecated_rule, + deprecated_reason=( + 'role:fizz is a more sane default for foo:create_bar' + ), + deprecated_since='N' + ) + opts = {'rules': [new_rule]} + + extensions = [] + for name, opts in opts.items(): + ext = stevedore.extension.Extension(name=name, entry_point=None, + plugin=None, obj=opts) + extensions.append(ext) + test_mgr = stevedore.named.NamedExtensionManager.make_test_instance( + extensions=extensions, namespace=['rules']) + + expected = '''# Create a bar. +#"foo:create_bar": "role:fizz" + +# DEPRECATED "foo:create_bar":"role:old" has been deprecated since N +# in favor of "foo:create_bar":"role:fizz". role:fizz is a more sane +# default for foo:create_bar +''' + stdout = self._capture_stdout() + with mock.patch('stevedore.named.NamedExtensionManager', + return_value=test_mgr) as mock_ext_mgr: + generator._generate_sample(['rules'], output_file=None) + mock_ext_mgr.assert_called_once_with( + 'oslo.policy.policies', names=['rules'], + on_load_failure_callback=generator.on_load_failure_callback, + invoke_on_load=True + ) + self.assertEqual(expected, stdout.getvalue()) + def _test_formatting(self, description, expected): rule = [policy.RuleDefault('admin', 'is_admin:True', description=description)] @@ -675,3 +718,21 @@ expected = '''new_policy_name: rule:admin ''' self.assertEqual(expected, stdout.getvalue()) + + [email protected]('stevedore.named.NamedExtensionManager') +class GetEnforcerTestCase(base.PolicyBaseTestCase): + def test_get_enforcer(self, mock_manager): + mock_instance = mock.MagicMock() + mock_instance.__contains__.return_value = True + mock_manager.return_value = mock_instance + mock_item = mock.Mock() + mock_item.obj = 'test' + mock_instance.__getitem__.return_value = mock_item + self.assertEqual('test', generator._get_enforcer('foo')) + + def test_get_enforcer_missing(self, mock_manager): + mock_instance = mock.MagicMock() + mock_instance.__contains__.return_value = False + mock_manager.return_value = mock_instance + self.assertRaises(KeyError, generator._get_enforcer, 'nonexistent') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.policy-2.1.1/oslo_policy/tests/test_policy.py new/oslo.policy-2.3.2/oslo_policy/tests/test_policy.py --- old/oslo.policy-2.1.1/oslo_policy/tests/test_policy.py 2019-02-28 19:04:10.000000000 +0100 +++ new/oslo.policy-2.3.2/oslo_policy/tests/test_policy.py 2019-09-12 18:37:51.000000000 +0200 @@ -1281,6 +1281,76 @@ enforcer.load_rules() mock_warn.assert_not_called() + def test_deprecate_check_str_suppress_does_not_log_warning(self): + deprecated_rule = policy.DeprecatedRule( + name='foo:create_bar', + check_str='role:fizz' + ) + + rule_list = [policy.DocumentedRuleDefault( + name='foo:create_bar', + check_str='role:bang', + description='Create a bar.', + operations=[{'path': '/v1/bars', 'method': 'POST'}], + deprecated_rule=deprecated_rule, + deprecated_reason='"role:bang" is a better default', + deprecated_since='N' + )] + enforcer = policy.Enforcer(self.conf) + enforcer.suppress_deprecation_warnings = True + enforcer.register_defaults(rule_list) + with mock.patch('warnings.warn') as mock_warn: + enforcer.load_rules() + mock_warn.assert_not_called() + + def test_deprecate_name_suppress_does_not_log_warning(self): + deprecated_rule = policy.DeprecatedRule( + name='foo:bar', + check_str='role:baz' + ) + + rule_list = [policy.DocumentedRuleDefault( + name='foo:create_bar', + check_str='role:baz', + description='Create a bar.', + operations=[{'path': '/v1/bars/', 'method': 'POST'}], + deprecated_rule=deprecated_rule, + deprecated_reason='"foo:bar" is not granular enough.', + deprecated_since='N' + )] + + rules = jsonutils.dumps({'foo:bar': 'role:bang'}) + self.create_config_file('policy.json', rules) + enforcer = policy.Enforcer(self.conf) + enforcer.suppress_deprecation_warnings = True + enforcer.register_defaults(rule_list) + + with mock.patch('warnings.warn') as mock_warn: + enforcer.load_rules() + mock_warn.assert_not_called() + + def test_deprecate_for_removal_suppress_does_not_log_warning(self): + rule_list = [policy.DocumentedRuleDefault( + name='foo:bar', + check_str='role:baz', + description='Create a foo.', + operations=[{'path': '/v1/foos/', 'method': 'POST'}], + deprecated_for_removal=True, + deprecated_reason=( + '"foo:bar" is no longer a policy used by the service' + ), + deprecated_since='N' + )] + rules = jsonutils.dumps({'foo:bar': 'role:bang'}) + self.create_config_file('policy.json', rules) + enforcer = policy.Enforcer(self.conf) + enforcer.suppress_deprecation_warnings = True + enforcer.register_defaults(rule_list) + + with mock.patch('warnings.warn') as mock_warn: + enforcer.load_rules() + mock_warn.assert_not_called() + def test_deprecated_policy_for_removal_must_include_deprecated_since(self): self.assertRaises( ValueError, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.policy-2.1.1/oslo_policy/tests/test_sphinxext.py new/oslo.policy-2.3.2/oslo_policy/tests/test_sphinxext.py --- old/oslo.policy-2.1.1/oslo_policy/tests/test_sphinxext.py 2019-02-28 19:04:10.000000000 +0100 +++ new/oslo.policy-2.3.2/oslo_policy/tests/test_sphinxext.py 2019-09-12 18:37:51.000000000 +0200 @@ -20,6 +20,36 @@ from oslo_policy import sphinxext +class IndentTest(base.BaseTestCase): + + def test_indent(self): + result = sphinxext._indent("foo\nbar") + self.assertEqual(" foo\n bar", result) + + result = sphinxext._indent("") + self.assertEqual("", result) + + result = sphinxext._indent("\n") + self.assertEqual("\n", result) + + result = sphinxext._indent("test\ntesting\n\nafter blank") + self.assertEqual(" test\n testing\n\n after blank", result) + + result = sphinxext._indent("\tfoo\nbar") + self.assertEqual(" \tfoo\n bar", result) + + result = sphinxext._indent(" foo\nbar") + self.assertEqual(" foo\n bar", result) + + result = sphinxext._indent("foo\n bar") + self.assertEqual(" foo\n bar", result) + + result = sphinxext._indent("foo\n\n bar") + self.assertEqual(" foo\n\n bar", result) + + self.assertRaises(AttributeError, sphinxext._indent, None) + + class FormatPolicyTest(base.BaseTestCase): def test_minimal(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.policy-2.1.1/releasenotes/source/index.rst new/oslo.policy-2.3.2/releasenotes/source/index.rst --- old/oslo.policy-2.1.1/releasenotes/source/index.rst 2019-02-28 19:04:10.000000000 +0100 +++ new/oslo.policy-2.3.2/releasenotes/source/index.rst 2019-09-12 18:37:51.000000000 +0200 @@ -6,6 +6,7 @@ :maxdepth: 1 unreleased + stein rocky queens pike diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.policy-2.1.1/releasenotes/source/stein.rst new/oslo.policy-2.3.2/releasenotes/source/stein.rst --- old/oslo.policy-2.1.1/releasenotes/source/stein.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/oslo.policy-2.3.2/releasenotes/source/stein.rst 2019-09-12 18:37:51.000000000 +0200 @@ -0,0 +1,6 @@ +=================================== + Stein Series Release Notes +=================================== + +.. release-notes:: + :branch: stable/stein diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.policy-2.1.1/setup.cfg new/oslo.policy-2.3.2/setup.cfg --- old/oslo.policy-2.1.1/setup.cfg 2019-02-28 19:07:49.000000000 +0100 +++ new/oslo.policy-2.3.2/setup.cfg 2019-09-12 18:38:29.000000000 +0200 @@ -16,7 +16,8 @@ Programming Language :: Python :: 2 Programming Language :: Python :: 2.7 Programming Language :: Python :: 3 - Programming Language :: Python :: 3.5 + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 [files] packages = diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.policy-2.1.1/test-requirements.txt new/oslo.policy-2.3.2/test-requirements.txt --- old/oslo.policy-2.1.1/test-requirements.txt 2019-02-28 19:04:10.000000000 +0100 +++ new/oslo.policy-2.3.2/test-requirements.txt 2019-09-12 18:37:51.000000000 +0200 @@ -3,18 +3,12 @@ # process, which may cause wedges in the gate later. hacking>=1.1.0,<1.2.0 # Apache-2.0 oslotest>=3.2.0 # Apache-2.0 -requests-mock>=1.1.0 # Apache-2.0 +requests-mock>=1.2.0 # Apache-2.0 stestr>=2.0.0 # Apache-2.0 oslo.context>=2.22.0 # Apache-2.0 # computes code coverage percentages coverage!=4.4,>=4.0 # Apache-2.0 -# These are needed for docs generation -openstackdocstheme>=1.18.1 # Apache-2.0 -sphinx!=1.6.6,!=1.6.7,>=1.6.5 # BSD - -reno>=2.5.0 # Apache-2.0 - # Bandit security code scanner -bandit>=1.1.0 # Apache-2.0 +bandit>=1.1.0,<1.6.0 # Apache-2.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.policy-2.1.1/tox.ini new/oslo.policy-2.3.2/tox.ini --- old/oslo.policy-2.1.1/tox.ini 2019-02-28 19:04:10.000000000 +0100 +++ new/oslo.policy-2.3.2/tox.ini 2019-09-12 18:37:51.000000000 +0200 @@ -1,13 +1,14 @@ [tox] minversion = 2.0 -envlist = py35,py27,pep8,docs +envlist = py27,py37,pep8,docs [testenv] install_command = pip install {opts} {packages} deps = - -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} + -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} -r{toxinidir}/test-requirements.txt -r{toxinidir}/requirements.txt + -r{toxinidir}/doc/requirements.txt commands = stestr run --slowest {posargs} [testenv:py27] @@ -28,7 +29,14 @@ [testenv:docs] basepython = python3 -commands = python setup.py build_sphinx +whitelist_externals = + rm +deps = + {[testenv]deps} + -r{toxinidir}/doc/requirements.txt +commands = + rm -rf doc/build + sphinx-build -W -b html doc/source doc/build/html [testenv:cover] basepython = python3 @@ -54,3 +62,4 @@ -c{toxinidir}/lower-constraints.txt -r{toxinidir}/test-requirements.txt -r{toxinidir}/requirements.txt + -r{toxinidir}/doc/requirements.txt
