When authorize() with tenant report an error

Bug #1964737 reported by Brin Zhang
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cyborg (OpenStack)
Fix Released
High
Brin Zhang
Yoga
Fix Released
Undecided
Unassigned

Bug Description

https://review.opendev.org/c/openstack/cyborg/+/831908
https://review.opendev.org/c/openstack/cyborg/+/831908
https://review.opendev.org/c/openstack/cyborg/+/777340

Above patches have reported the same error when using 'tenant' from context, and the tenant parameter should be replaced with proect_id/user_id.

One log as below: https://7e8031ae78b4e3d0b4bb-18cd7f889ae1379763e7ec0a1ec70a8d.ssl.cf1.rackcdn.com/777340/3/gate/openstack-tox-py36/ae874ef/testr_results.html
ft1.2: cyborg.tests.unit.api.controllers.v2.test_arqs.TestARQsController.test_createtesttools.testresult.real._StringException: Traceback (most recent call last):
  File "/usr/lib/python3.6/unittest/mock.py", line 1183, in patched
    return func(*args, **keywargs)
  File "/home/zuul/src/opendev.org/openstack/cyborg/cyborg/tests/unit/api/controllers/v2/test_arqs.py", line 194, in test_create
    response = self.post_json(self.ARQ_URL, params, headers=self.headers)
  File "/home/zuul/src/opendev.org/openstack/cyborg/cyborg/tests/unit/api/base.py", line 114, in post_json
    status=status, method="post")
  File "/home/zuul/src/opendev.org/openstack/cyborg/cyborg/tests/unit/api/base.py", line 93, in _request_json
    expect_errors=expect_errors
  File "/home/zuul/src/opendev.org/openstack/cyborg/.tox/py36/lib/python3.6/site-packages/webtest/utils.py", line 34, in wrapper
    return self._gen_request(method, url, **kw)
  File "/home/zuul/src/opendev.org/openstack/cyborg/.tox/py36/lib/python3.6/site-packages/webtest/app.py", line 750, in _gen_request
    expect_errors=expect_errors)
  File "/home/zuul/src/opendev.org/openstack/cyborg/.tox/py36/lib/python3.6/site-packages/webtest/app.py", line 620, in do_request
    res = req.get_response(app, catch_exc_info=True)
  File "/home/zuul/src/opendev.org/openstack/cyborg/.tox/py36/lib/python3.6/site-packages/webob/request.py", line 1310, in send
    application, catch_exc_info=True)
  File "/home/zuul/src/opendev.org/openstack/cyborg/.tox/py36/lib/python3.6/site-packages/webob/request.py", line 1278, in call_application
    app_iter = application(self.environ, start_response)
  File "/home/zuul/src/opendev.org/openstack/cyborg/.tox/py36/lib/python3.6/site-packages/webtest/lint.py", line 196, in lint_app
    iterator = application(environ, start_response_wrapper)
  File "/home/zuul/src/opendev.org/openstack/cyborg/.tox/py36/lib/python3.6/site-packages/pecan/middleware/recursive.py", line 56, in __call__
    return self.application(environ, start_response)
  File "/home/zuul/src/opendev.org/openstack/cyborg/cyborg/api/middleware/parsable_error.py", line 58, in __call__
    app_iter = self.app(environ, replacement_start_response)
  File "/home/zuul/src/opendev.org/openstack/cyborg/.tox/py36/lib/python3.6/site-packages/pecan/core.py", line 852, in __call__
    return super(Pecan, self).__call__(environ, start_response)
  File "/home/zuul/src/opendev.org/openstack/cyborg/.tox/py36/lib/python3.6/site-packages/pecan/core.py", line 693, in __call__
    self.invoke_controller(controller, args, kwargs, state)
  File "/home/zuul/src/opendev.org/openstack/cyborg/.tox/py36/lib/python3.6/site-packages/pecan/core.py", line 584, in invoke_controller
    result = controller(*args, **kwargs)
  File "/home/zuul/src/opendev.org/openstack/cyborg/cyborg/common/authorize_wsgi.py", line 195, in handle
    target = {'project_id': context.tenant,
AttributeError: 'RequestContext' object has no attribute 'tenant'

Brin Zhang (zhangbailin)
Changed in openstack-cyborg:
importance: Undecided → High
Changed in openstack-cyborg:
status: New → In Progress
Brin Zhang (zhangbailin)
Changed in openstack-cyborg:
assignee: nobody → Brin Zhang (zhangbailin)
Revision history for this message
Brin Zhang (zhangbailin) wrote :

oslo.context 4.1.0 has removed the deprecated field
'tenant' and nova unit test fail as it still expect
the 'tenant' field.

Failure happening in requirements patch while updating the
u-c
- https://review.opendev.org/c/openstack/requirements/+/829599
- http://lists.openstack.org/pipermail/openstack-discuss/2022-February/027455.html

summary: - When authorize() with tenat report an error
+ When authorize() with tenant report an error
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cyborg (master)

Reviewed: https://review.opendev.org/c/openstack/cyborg/+/833529
Committed: https://opendev.org/openstack/cyborg/commit/52e3bc8a0d9c707711d032bf23a901fc2fbed2c9
Submitter: "Zuul (22348)"
Branch: master

commit 52e3bc8a0d9c707711d032bf23a901fc2fbed2c9
Author: zhangbailin <email address hidden>
Date: Mon Mar 14 10:15:16 2022 +0800

    Fix unit test for oslo.context 4.1.0

    oslo.context 4.1.0 has removed the deprecated field
    'tenant' and nova unit test fail as it still expect
    the 'tenant' field.

    Failure happening in requirements patch while updating the
    u-c
    - https://review.opendev.org/c/openstack/requirements/+/829599
    - http://lists.openstack.org/pipermail/openstack-discuss/2022-February/027455.html

    Closes-Bug: #1964737

    Change-Id: I899f3b442217d09f98c1fbdb3a72c623a9d2ffaf

Changed in openstack-cyborg:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cyborg (stable/yoga)

Fix proposed to branch: stable/yoga
Review: https://review.opendev.org/c/openstack/cyborg/+/833567

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cyborg (stable/yoga)

Reviewed: https://review.opendev.org/c/openstack/cyborg/+/833567
Committed: https://opendev.org/openstack/cyborg/commit/7cf03aa5b6771c4cf564474e198f6d7e7c66c6ac
Submitter: "Zuul (22348)"
Branch: stable/yoga

commit 7cf03aa5b6771c4cf564474e198f6d7e7c66c6ac
Author: zhangbailin <email address hidden>
Date: Mon Mar 14 10:15:16 2022 +0800

    Fix unit test for oslo.context 4.1.0

    oslo.context 4.1.0 has removed the deprecated field
    'tenant' and nova unit test fail as it still expect
    the 'tenant' field.

    Failure happening in requirements patch while updating the
    u-c
    - https://review.opendev.org/c/openstack/requirements/+/829599
    - http://lists.openstack.org/pipermail/openstack-discuss/2022-February/027455.html

    Closes-Bug: #1964737

    Change-Id: I899f3b442217d09f98c1fbdb3a72c623a9d2ffaf
    (cherry picked from commit 52e3bc8a0d9c707711d032bf23a901fc2fbed2c9)

tags: added: in-stable-yoga
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/cyborg 9.0.0.0rc1

This issue was fixed in the openstack/cyborg 9.0.0.0rc1 release candidate.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/cyborg 8.0.1

This issue was fixed in the openstack/cyborg 8.0.1 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.