Skip to content

Commit 8c44864

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 08a22b5 commit 8c44864

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
@@ -286,10 +286,14 @@ def get(self, scope_ids=[], path_scope_id=None, offset=0, limit=100,
286286
if not isinstance(scope_ids, list):
287287
scope_ids = [scope_ids]
288288

289+
# Some versions of python-cloudkittyclient can send the order in upper
290+
# case, e.g. "DESC". Convert it to lower case for compatibility.
291+
order = order.lower()
292+
289293
if order not in ACCEPTED_GET_REPROCESSING_REQUEST_ORDERS:
290294
raise http_exceptions.BadRequest(
291-
"The order [%s] is not valid. Accepted values are %s.",
292-
order, ACCEPTED_GET_REPROCESSING_REQUEST_ORDERS)
295+
"The order [%s] is not valid. Accepted values are %s." %
296+
(order, ACCEPTED_GET_REPROCESSING_REQUEST_ORDERS))
293297

294298
schedules = self.schedule_reprocessing_db.get_all(
295299
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)