[API] keyerror for 'name' and 'description' when node composition

Bug #1677046 reported by Lin Yang
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Valence
Fix Released
High
Unassigned

Bug Description

When user didn't specify proper 'name' and 'description' field when compose node, api will raise key error but it is user friendly, like below shows.

>curl -vvvv -X POST -H "Content-Type: application/json" -d '{"Name":"test"}' http://127.0.0.1:8181/v1/nodes/

{
  "code": "KeyError",
  "detail": "'name'",
  "request_id": "00000000-0000-0000-0000-000000000000",
  "status": 500,
  "title": "KeyError"
}

This is caused by nodes controller don't check whether those keys exists,
https://github.com/openstack/valence/blob/0db8a8e186e25ded2b17460f5ae2ce9abf576851/valence/controller/nodes.py#L75

It should convert keyerror to a user-friendly message.

Lin Yang (lin-a-yang)
Changed in openstack-valence:
assignee: nobody → Lin Yang (lin-a-yang)
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to valence (master)

Fix proposed to branch: master
Review: https://review.openstack.org/451105

Changed in openstack-valence:
status: New → In Progress
Changed in openstack-valence:
assignee: Lin Yang (lin-a-yang) → Anusha (anusha-iiitm)
Anusha (anusha-iiitm)
Changed in openstack-valence:
assignee: Anusha (anusha-iiitm) → nobody
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to valence (master)

Reviewed: https://review.openstack.org/451105
Committed: https://git.openstack.org/cgit/openstack/valence/commit/?id=d0b9f60bba7da640631db9e14bab2189a54dc74d
Submitter: Jenkins
Branch: master

commit d0b9f60bba7da640631db9e14bab2189a54dc74d
Author: Lin Yang <email address hidden>
Date: Tue Mar 28 15:58:58 2017 -0700

    Enable parameter check before node composition

    This patch enabled check for "name" field in request body before
    node composition, raise BadRequest exception if if don't exits.
    Changed "description" to optional, and will set it to empty string
    if it don't exist.

    Change-Id: Ib3624ad85e12823c5f6fd6321d3161b88a7b6ecf
    Closes-Bug: #1677046

Changed in openstack-valence:
status: In Progress → Fix Released
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.