task-create API accepts empty dictionary as a input

Bug #1644442 reported by Pooja Jadhav
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
New
Undecided
Pooja Jadhav

Bug Description

User can create a task by passing empty dictionary ({}) as input to task-create api. Initially it shows task status a pending but when user tries to get detail of that task using task-show it shows message as "Input does not contain 'import_from' field" with status as failure, and that task will expired after 48 hrs and marked as deleted.
Even though it’s admin api, the failure task will never be used so IMO it should not create a task with empty dictionary for input and rejects the same with HTTPBadRequest.

Steps to reproduce :

1. Create task by passing empty input parameter:

                $ glance task-create --type import --input {}

                Output:

                +------------+--------------------------------------+
                | Property | Value |
                +------------+--------------------------------------+
                | created_at | 2016-11-23T06:41:22Z |
                | id | f19d6a47-5d6a-4430-bafc-95aaa5a2edc8 |
                | input | {} |
                | message | |
                | owner | 0ab69bb5b73f40d1a75f61de0447cb68 |
                | result | None |
                | status | pending |
                | type | import |
                | updated_at | 2016-11-23T06:41:22Z |
                +------------+--------------------------------------+

2. Display the created task:

                $ glance task-show f19d6a47-5d6a-4430-bafc-95aaa5a2edc8

                Output:

                +------------+--------------------------------------------+
                | Property | Value |
                +------------+--------------------------------------------+
                | created_at | 2016-11-23T06:41:22Z |
                | expires_at | 2016-11-25T06:41:22Z |
                | id | f19d6a47-5d6a-4430-bafc-95aaa5a2edc8 |
                | input | {} |
                | message | Input does not contain 'import_from' field |
                | owner | 0ab69bb5b73f40d1a75f61de0447cb68 |
                | result | None |
                | status | failure |
                | type | import |
                | updated_at | 2016-11-23T06:41:22Z |
                +------------+--------------------------------------------+

Changed in glance:
assignee: nobody → Pooja Jadhav (poojajadhav)
Revision history for this message
Deepak Mourya (mourya007) wrote :

Hi, i am trying to reproduce the bug after creating task with empty dictionary but my task is in pending state.

glance task-show 3232c8db-367a-4301-89c2-e71759b355b8
+------------+--------------------------------------+
| Property | Value |
+------------+--------------------------------------+
| created_at | 2018-05-29T06:49:51Z |
| id | 3232c8db-367a-4301-89c2-e71759b355b8 |
| input | {} |
| message | |
| owner | 6cbe607cf16348019a12a2b4727f85c9 |
| result | None |
| status | pending |
| type | import |
| updated_at | 2018-05-29T06:49:51Z |
+------------+--------------------------------------+

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.