Skip to content

Commit a6aaa11

Browse files
committed
Fix retrieval of reprocessing tasks
Calling GET /v2/task/reprocesses with python-cloudkittyclient was returning Internal Server Error, with the following API trace: File "/var/lib/kolla/venv/lib/python3.6/site-packages/cloudkitty/api/v2/task/reprocess.py", line 259, in get order, ACCEPTED_GET_REPROCESSING_REQUEST_ORDERS) TypeError: __init__() takes from 1 to 3 positional arguments but 4 were given This was because http_exceptions.BadRequest was given multiple arguments (similar to LOG.* methods) instead of a single string. Another issue is that python-cloudkittyclient sends the "DESC" order while the API only supports "desc" and "asc". Convert to lower case for compatibility. Change-Id: Id1145adff82bc9a01e4eb0f306f0bfa535142459 (cherry picked from commit 12347e1)
1 parent 35a2af3 commit a6aaa11

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

cloudkitty/api/v2/task/reprocess.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,14 @@ def get(self, scope_ids=[], path_scope_id=None, offset=0, limit=100,
253253
if not isinstance(scope_ids, list):
254254
scope_ids = [scope_ids]
255255

256+
# Some versions of python-cloudkittyclient can send the order in upper
257+
# case, e.g. "DESC". Convert it to lower case for compatibility.
258+
order = order.lower()
259+
256260
if order not in ACCEPTED_GET_REPROCESSING_REQUEST_ORDERS:
257261
raise http_exceptions.BadRequest(
258-
"The order [%s] is not valid. Accepted values are %s.",
259-
order, ACCEPTED_GET_REPROCESSING_REQUEST_ORDERS)
262+
"The order [%s] is not valid. Accepted values are %s." %
263+
(order, ACCEPTED_GET_REPROCESSING_REQUEST_ORDERS))
260264

261265
schedules = self.schedule_reprocessing_db.get_all(
262266
identifier=scope_ids, remove_finished=False,
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
fixes:
3+
- |
4+
Fix retrieval of reprocessing tasks which was returning ``Internal Server
5+
Error``.

0 commit comments

Comments
 (0)