A tenant can't get his own global quota limit

Bug #1610610 reported by Chaoyi Huang
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Kingbird
Fix Released
Undecided
Unassigned

Bug Description

If use user=demo, project_id=demo, openstack token issue to get the token for the demo user, and then execute the global quota limit show the limit for the tenant with the demo's project-id,

curl -H "Content-Type: application/json" -H "X-Auth-Token: $kb_token" http://127.0.0.1:8118/v1.0/$tenant_id/os-quota-sets/$tenant_id

File "/opt/stack/kingbird/kingbird/api/controllers/quota_manager.py", line 89, in get
    context, project_id)
  File "/opt/stack/kingbird/kingbird/db/sqlalchemy/api.py", line 112, in wrapper
    if not is_admin_context(args[0]) and not is_user_context(args[0]):
  File "/opt/stack/kingbird/kingbird/db/sqlalchemy/api.py", line 83, in is_user_context
    if not context.user or not context.tenant_id:
AttributeError: 'RequestContext' object has no attribute 'tenant_id'

Chaoyi Huang (joehuang)
description: updated
Revision history for this message
Dimitri Mazmanov (sorantis) wrote :

The project_id=demo by default doesn't have the admin rights. So I'd guess that if you tried with admin it'll work

Revision history for this message
Chaoyi Huang (joehuang) wrote :

Sure, even demo has no admin role, but he should be able to know how much resources left could be used

Changed in kingbird:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to kingbird (master)

Reviewed: https://review.openstack.org/361077
Committed: https://git.openstack.org/cgit/openstack/kingbird/commit/?id=f76d39eead65d304916898c5e5e5b13b83d20bef
Submitter: Jenkins
Branch: master

commit f76d39eead65d304916898c5e5e5b13b83d20bef
Author: Ashish Singh <email address hidden>
Date: Fri Aug 26 16:31:46 2016 +0530

    Fix quota get for non admin role user

    There were minor issues with context object
    manipulation which was raising exception during
    db access with non admin role users, fixed it.

    Change-Id: I8bf2b272b6feefc989a390e7b7869dbb58386534
    Closes-Bug: #1610610

Changed in kingbird:
status: In Progress → Fix Released
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.