The resource type API need to increase the inspection

Bug #1617561 reported by fengchaoyang
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Gnocchi
Fix Released
Medium
fengchaoyang

Bug Description

When I use resource type api to create a new resource type, I find if the attribute length_max less than length_min, max less than min, the resource type can also be created, such as:
POST /v1/resource_type HTTP/1.1
Content-Type: application/json
Content-Length: 360

{
  "attributes": {
    "display_name": {
      "required": true,
      "type": "string"
    },
    "enabled": {
      "required": false,
      "type": "bool"
    },
    "myid": {
      "type": "uuid"
    },
    "prefix": {
      "max_length": 3,
      "min_length": 8,
      "required": false,
      "type": "string"
    },
    "size": {
      "max": 32.8,
      "min": 5,
      "type": "number"
    }
  },
  "name": "my_custom_type"
}

| ipmi | |
| my_custom_type | - enabled: required: False , type: bool |
| | - prefix: min_length: 8 , max_length: 3 , type: string , required: False |
| | - size: max: 5 , required: True , type: number , min: 32.5 |
| | - display_name: min_length: 0 , max_length: 255 , type: string , required: True |
| | - myid: required: True , type: uuid
So we need to check whether the min is less than or equal to Max

Changed in gnocchi:
status: New → Confirmed
assignee: nobody → fengchaoyang (fengchaoyang)
Julien Danjou (jdanjou)
Changed in gnocchi:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to gnocchi (master)

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

Changed in gnocchi:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to gnocchi (master)

Reviewed: https://review.openstack.org/361604
Committed: https://git.openstack.org/cgit/openstack/gnocchi/commit/?id=6a8054cfefb041f4055406fc374e97190e04c1ce
Submitter: Jenkins
Branch: master

commit 6a8054cfefb041f4055406fc374e97190e04c1ce
Author: fengchaoyang <email address hidden>
Date: Sat Aug 27 23:55:26 2016 +0800

    Check whether the resource type attribute min is less than or equal to max

    When use resource type api to create a new resource type,
    check whether min and min_length is less than max and max_length

    Closes-Bug: #1617561
    Change-Id: Iccfe751f274066b4c11d15901b375dc1177e1887

Changed in gnocchi:
status: In Progress → Fix Committed
Julien Danjou (jdanjou)
Changed in gnocchi:
milestone: none → 3.0.0
status: Fix Committed → 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.