← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1265740] [NEW] incorrect return from exception.InvalidInput()

 

Public bug reported:

when I create instance, and set min_count=-1, like this:

openstack@openstack-001:~$ curl -i -H "X-Auth-Token:6db450ec28174970be674af55c644e23" -H "Content-Type:application/json" http://127.0.0.1:8774/v2/e7fdc71e46bd4945a57104f3899b1335/servers -d '{"server":{"name":"test","flavorRef":"42","imageRef":"2e33aff9-63b4-497c-9c1b-8fe4ee567cce","min_count":-1}}'
HTTP/1.1 400 Bad Request
Content-Length: 110
Content-Type: application/json; charset=UTF-8
X-Compute-Request-Id: req-b33a8f37-e4a4-42b3-8488-ca669e80911d
Date: Fri, 03 Jan 2014 08:04:18 GMT

{"badRequest": {"message": "\u6536\u5230\u65e0\u6548\u7684\u8f93\u5165:
min_count must be >= 1", "code": 400}}

the return message is messy code. I review the code, find the code:
 if min_value is not None:
        if value < min_value:
            msg = _('%(value_name)s must be >= %(min_value)d')
            raise exception.InvalidInput(
                reason=(msg % {'value_name': name,
                               'min_value': min_value}))

exception.InvalidInput has no para named reason. the para is message.
replace message to reason, it is ok.

** Affects: cinder
     Importance: Undecided
     Assignee: lizheming (lizheming-li)
         Status: New

** Affects: nova
     Importance: Undecided
     Assignee: lizheming (lizheming-li)
         Status: New

** Changed in: nova
     Assignee: (unassigned) => lizheming (lizheming-li)

** Also affects: cinder
   Importance: Undecided
       Status: New

** Changed in: cinder
     Assignee: (unassigned) => lizheming (lizheming-li)

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1265740

Title:
  incorrect return from exception.InvalidInput()

Status in Cinder:
  New
Status in OpenStack Compute (Nova):
  New

Bug description:
  when I create instance, and set min_count=-1, like this:

  openstack@openstack-001:~$ curl -i -H "X-Auth-Token:6db450ec28174970be674af55c644e23" -H "Content-Type:application/json" http://127.0.0.1:8774/v2/e7fdc71e46bd4945a57104f3899b1335/servers -d '{"server":{"name":"test","flavorRef":"42","imageRef":"2e33aff9-63b4-497c-9c1b-8fe4ee567cce","min_count":-1}}'
  HTTP/1.1 400 Bad Request
  Content-Length: 110
  Content-Type: application/json; charset=UTF-8
  X-Compute-Request-Id: req-b33a8f37-e4a4-42b3-8488-ca669e80911d
  Date: Fri, 03 Jan 2014 08:04:18 GMT

  {"badRequest": {"message":
  "\u6536\u5230\u65e0\u6548\u7684\u8f93\u5165: min_count must be >= 1",
  "code": 400}}

  the return message is messy code. I review the code, find the code:
   if min_value is not None:
          if value < min_value:
              msg = _('%(value_name)s must be >= %(min_value)d')
              raise exception.InvalidInput(
                  reason=(msg % {'value_name': name,
                                 'min_value': min_value}))

  exception.InvalidInput has no para named reason. the para is message.
  replace message to reason, it is ok.

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


Follow ups

References