← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1264452] [NEW] update method in os-services api raise unexpect exception

 

Public bug reported:

when review the os-services v3api code, I found update method have some bug.
the original code:
    ........ 
    except (TypeError, KeyError):
            msg = _('Invalid attribute in the request')
            if 'host' in body and 'binary' in body:
                msg = _('Missing disabled reason field')
            raise webob.exc.HTTPBadRequest(detail=msg)

parameter body is a dict:
body={"service":{
                                "host":"xxx",
                               "binary":"xxxx",
                                ....
                                }}
so the 'msg'  will nerver be '_('Missing disabled reason field')'.
the code should be  "if "host" in body['service']" not "if "host" in body"

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

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

** Changed in: nova
       Status: New => In Progress

-- 
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/1264452

Title:
   update method in  os-services api raise unexpect exception

Status in OpenStack Compute (Nova):
  In Progress

Bug description:
  when review the os-services v3api code, I found update method have some bug.
  the original code:
      ........ 
      except (TypeError, KeyError):
              msg = _('Invalid attribute in the request')
              if 'host' in body and 'binary' in body:
                  msg = _('Missing disabled reason field')
              raise webob.exc.HTTPBadRequest(detail=msg)

  parameter body is a dict:
  body={"service":{
                                  "host":"xxx",
                                 "binary":"xxxx",
                                  ....
                                  }}
  so the 'msg'  will nerver be '_('Missing disabled reason field')'.
  the code should be  "if "host" in body['service']" not "if "host" in body"

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


Follow ups

References