← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1652719] Re: The JSON-Schema of string integer can't handle the case of empty string

 

Reviewed:  https://review.openstack.org/415103
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=934ccef0bd0fb3acf5a20160478a989c1bcba017
Submitter: Jenkins
Branch:    master

commit 934ccef0bd0fb3acf5a20160478a989c1bcba017
Author: He Jie Xu <hejie.xu@xxxxxxxxx>
Date:   Tue Dec 27 14:27:42 2016 +0800

    Limit the min length of string for integer JSON-Schema
    
    The JSON-Schema of integer string is without min length limits. That
    leads to the user can input empty string, and nova API code can't
    handle that case. Finally the user will get 500 returned.
    
    The create_backup and multi_create API are fixed. The networks and
    tenant_networks API have same problem on few parameters, but due
    to the nova-network is deprecated, so just keep those nova-network
    specific API behaviour as before.
    
    Change-Id: I521e914fc48b7a221431f41c567f2cb4b9b4ab99
    Closes-bug: #1652719


** Changed in: nova
       Status: In Progress => Fix Released

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

Title:
  The JSON-Schema of string integer can't handle the case of empty
  string

Status in OpenStack Compute (nova):
  Fix Released

Bug description:
  The schema of string integer didn't handle the case of empty string

  https://github.com/openstack/nova/blob/master/nova/api/validation/parameter_types.py#L186

  positive_integer = {
      'type': ['integer', 'string'],
      'pattern': '^[0-9]*$', 'minimum': 1
  }

  
  non_negative_integer = {
      'type': ['integer', 'string'],
      'pattern': '^[0-9]*$', 'minimum': 0
  }

  
  There is no limit on the length of string. So the user can input a empty string. When I input empty string, the nova api return 500.

  The affected APIs are:
  1. create_backup
  2. server create with multiple create
  3. networks
  4. tenant_networks

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


References