← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1644442] [NEW] task-create API accepts empty dictionary as a input

 

Public bug reported:

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                       |
                +------------+--------------------------------------------+

** Affects: glance
     Importance: Undecided
     Assignee: Pooja Jadhav (poojajadhav)
         Status: New

** Changed in: glance
     Assignee: (unassigned) => Pooja Jadhav (poojajadhav)

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Glance.
https://bugs.launchpad.net/bugs/1644442

Title:
  task-create API accepts empty dictionary as a input

Status in Glance:
  New

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                       |
                  +------------+--------------------------------------------+

To manage notifications about this bug go to:
https://bugs.launchpad.net/glance/+bug/1644442/+subscriptions