Listing secrets/orders without parameters causes 500 error

Bug #1202857 reported by Melissa Kam
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Barbican
Fix Released
High
John Vrbanac

Bug Description

Steps to Recreate:

Secrets
Request
POST http://.../v1/test_tenant/secrets

Response
500 Internal Server Error
{
"title": "Secret(s) retrieval failure seen - please contact site administrator"
}

Orders
Request
POST http://.../v1/test_tenant/orders

Response
500 Internal Server Error
{
"title": "Order(s) retrieval failure seen - please contact site administrator"
}

John Wood (john-wood-w)
Changed in cloudkeep:
milestone: none → havana-3
importance: Undecided → High
Changed in cloudkeep:
status: New → Confirmed
Revision history for this message
John Vrbanac (john.vrbanac) wrote :

Cause of the error introduced in: https://review.openstack.org/#/c/37124/1/barbican/model/repositories.py
Line 219 is only catching ValueError. The int cast of the None raises a TypeError

Revision history for this message
John Wood (john-wood-w) wrote :

Per John V., the fix for this is to add a line like this before the try block line:

offset_arg = offset_arg or 0

or

limit_arg = limit_arg or 0

...depending on which try/catch block it is. Then no need to add a 'TypeError' catch!

Revision history for this message
John Vrbanac (john.vrbanac) wrote :

limit_arg would actually be:

limit_arg = limit_arg or CONF.default_limit_paging

Revision history for this message
Malini Bhandaru (malini-k-bhandaru) wrote :

Good suggestions, adding the conf.default_limit_paging makes things cleaner and safer.
Should we have some protection for an offset that falls off the total number of elements than can be returned?
May be not because it cannot be determined apriori ?

Changed in cloudkeep:
assignee: nobody → Joel Cooklin (joel-cooklin)
assignee: Joel Cooklin (joel-cooklin) → nobody
Changed in cloudkeep:
status: Confirmed → Fix Committed
assignee: nobody → John Vrbanac (john.vrbanac)
Changed in cloudkeep:
status: Fix Committed → 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.