ActionExecution task_name field cannot be used in a fields= query parameter
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mistral |
Confirmed
|
Medium
|
Unassigned |
Bug Description
The ActionExecution task_name attribute cannot be used in a fields= query parameter on a GET.
When task_name is specified by itself it is ignored:
# http 'http://
HTTP/1.1 200 OK
Connection: keep-alive
Content-Length: 237
Content-Type: application/json
Date: Sun, 28 Oct 2018 03:47:34 GMT
{
"action_
{
"id": "27a95254-
}
],
"next": "http://
}
and when it is followed by other fields it can break the query:
# http http://
HTTP/1.1 400 Bad Request
Connection: keep-alive
Content-Length: 175
Content-Type: application/json
Date: Sun, 28 Oct 2018 03:49:47 GMT
{
"debuginfo": null,
"faultcode": "Client",
"faultstring": "Invalid input for field/attribute state. Value: 'True'. Wrong type. Expected '<class 'str'>', got '<class 'bool'>'"
}
This is caused by the fact that task_name is derived from the task_execution backref, which requires the DBModel to access the name. When specific columns/fields are requested the return from the database is a list of tuples instead of a list of DBModels, so the DBModel is not available to retrieve the task name.
The query breaks because the call to from_tuples() zips the fields with the results of the database query, and there is an "extra" field for task_name that does not line up with the values returned from the database query, so everything gets misaligned and the values don't match the fields they are matched with.
The second problem can be fixed by looking for the task_name field and moving it to the end of the fields list, so at least the query won't break.
I'm not sure how to fix the main problem of retrieving the task_name from the task_execution backref - hopefully someone more familiar with the API and sqlalchemy can suggest a fix.
Changed in mistral: | |
status: | New → Confirmed |
importance: | Undecided → Medium |