requires positional >= 1.1.0

Bug #1620963 reported by James Page on 2016-09-07
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Barbican
Fix Released
Undecided
Unassigned
oslo.context
Undecided
Unassigned

Bug Description

oslo.context currently specifies:

  positional>=1.0.1 # Apache-2.0

however using this version causes a number of unit test failures in barbican; updating to 1.1.1 resolves this issue, so global-requirements should probably be bumped inline with this.

James Page (james-page) wrote :

Build log for reference:

https://launchpadlibrarian.net/282940347/buildlog_ubuntu-yakkety-amd64.barbican_1%3A3.0.0~b3-0ubuntu1~ubuntu16.10.1~ppa201609061227_BUILDING.txt.gz

Its also easy to reproduce by downgrading positional to 1.0.1 in the barbican py27 venv and then re-running the tests.

James Page (james-page) wrote :
Download full text (3.1 KiB)

Captured pythonlogging:
~~~~~~~~~~~~~~~~~~~~~~~
       ERROR [barbican.api.controllers] ContainerConsumer deletion attempt not allowed - please review your user/project privileges

barbican.tests.api.test_resources_policy.WhenTestingConsumersResource.test_should_pass_get_consumers
----------------------------------------------------------------------------------------------------

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    Traceback (most recent call last):
      File "barbican/tests/api/test_resources_policy.py", line 1069, in test_should_pass_get_consumers
        content_type='application/json')
      File "barbican/tests/api/test_resources_policy.py", line 184, in _assert_pass_rbac
        method_under_test)
      File "/usr/lib/python2.7/dist-packages/testtools/testcase.py", line 422, in assertRaises
        self.assertThat(our_callable, matcher)
      File "/usr/lib/python2.7/dist-packages/testtools/testcase.py", line 433, in assertThat
        mismatch_error = self._matchHelper(matchee, matcher, message, verbose)
      File "/usr/lib/python2.7/dist-packages/testtools/testcase.py", line 483, in _matchHelper
        mismatch = matcher.match(matchee)
      File "/usr/lib/python2.7/dist-packages/testtools/matchers/_exception.py", line 108, in match
        mismatch = self.exception_matcher.match(exc_info)
      File "/usr/lib/python2.7/dist-packages/testtools/matchers/_higherorder.py", line 62, in match
        mismatch = matcher.match(matchee)
      File "/usr/lib/python2.7/dist-packages/testtools/testcase.py", line 414, in match
        reraise(*matchee)
      File "/usr/lib/python2.7/dist-packages/testtools/matchers/_exception.py", line 101, in match
        result = matchee()
      File "/usr/lib/python2.7/dist-packages/testtools/testcase.py", line 969, in __call__
        return self._callable_object(*self._args, **self._kwargs)
      File "barbican/tests/api/test_resources_policy.py", line 1083, in _invoke_on_get
        self.resource.on_get(self.req, self.resp)
      File "barbican/tests/api/test_resources_policy.py", line 54, in on_get
        return self.controller.on_get(*args, **kwargs)
      File "barbican/api/controllers/__init__.py", line 113, in handler
        pecan.abort(status, message)
      File "/usr/lib/python2.7/dist-packages/pecan/core.py", line 138, in abort
        exec('raise webob_exception, None, traceback')
      File "barbican/api/controllers/__init__.py", line 103, in handler
        return fn(inst, *args, **kwargs)
      File "barbican/api/controllers/__init__.py", line 84, in enforcer
        _do_enforce_rbac(inst, pecan.request, action_name, ctx, **kwargs)
      File "barbican/api/controllers/__init__.py", line 67, in _do_enforce_rbac
        credentials, do_raise=True)
      File "/usr/lib/python2.7/dist-packages/oslo_policy/policy.py", line 653, in enforce
        raise PolicyNotAuthorized(rule, target, creds)
    webob.exc.HTTPForbidden: ContainerConsumers(s) retrieval attempt not allowed - please review your user/project privileges

Captured pythonlogging:
~~~~~~~~~~~~~~~~~~~~~~~
       ERROR [barbican.api.controllers] ContainerConsumers(s) retrieval attempt not allowed - please review your...

Read more...

Jamie Lennox (jamielennox) wrote :

This is because barbican does inspect on oslo_context.RequestContext.__init__ and positional < 1.1 used @functools.wraps which makes a mess of this.

The inspect part of barbican is no longer needed so we can just remove this and positional 1.0.1 should continue to work.

Reviewed: https://review.openstack.org/369092
Committed: https://git.openstack.org/cgit/openstack/barbican/commit/?id=6c814fefbc062b2643b52bb5281743b482f6ea9c
Submitter: Jenkins
Branch: master

commit 6c814fefbc062b2643b52bb5281743b482f6ea9c
Author: Jamie Lennox <email address hidden>
Date: Tue Sep 13 10:44:38 2016 +1000

    Don't inspect oslo.context

    When creating an oslo.context we inspected the __init__ string to figure
    out if roles were part of the context. This was added in oslo.context
    2.2 and there needed to be compatibility between old and new.

    Now that requirements specify oslo.context >= 2.9 we don't need this
    clause any more, and it is causing release issues with older versions of
    positional.

    Remove the inspection and rely on newer versions of oslo.context.

    Closes-Bug: #1620963
    Change-Id: I2fcb4f1718ae5e5b50e26d9dee0e0df2f1e6cf72

Changed in barbican:
status: New → Fix Released

This issue was fixed in the openstack/barbican 3.0.0.0rc1 release candidate.

This issue was fixed in the openstack/barbican 3.0.0 release.

Doug Hellmann (doug-hellmann) wrote :

oslo.context no longer uses positional

Changed in oslo.context:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers