← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1649885] [NEW] Valid values should be visible

 

Public bug reported:

Currently, if we specify wrong value with validated 'valid_values'(e.g. ['deny', 'allow', 'all']),
following message returns:

[example]
$ curl -i -X POST -d '{"firewall_rule":{"action": "sleeping_beauty", "protocol":"tcp"}}'  -H "x-auth-token:$TOKEN" 192.168.122.181:9696/v2.0/fwaas/firewall_rules

{"NeutronError": {"message": "Invalid input for action. Reason:
sleeping_beauty is not in valid_values.", "type": "HTTPBadRequest",
"detail": ""}}

A user cannot understand what is valid_values.  Therefore,  validate_values[1] should be fixed.
In "neutron/api/v2/attributes.py" line 332,  it is called by following format[2]:

validator(res_dict[attr], attr_vals['validate'][rule])

If validator is validate_values, 'valid_values_display' which is 3rd arguments is always None.
Therefore, if an error occurred, it definitely returns "valid_values" in an error message.

[1]https://github.com/openstack/neutron-lib/blob/master/neutron_lib/api/validators.py#L96
[2]https://github.com/openstack/neutron/blob/master/neutron/api/v2/attributes.py#L332

** Affects: neutron
     Importance: Undecided
     Assignee: Yushiro FURUKAWA (y-furukawa-2)
         Status: New


** Tags: lib

** Changed in: neutron
     Assignee: (unassigned) => Yushiro FURUKAWA (y-furukawa-2)

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1649885

Title:
  Valid values should be visible

Status in neutron:
  New

Bug description:
  Currently, if we specify wrong value with validated 'valid_values'(e.g. ['deny', 'allow', 'all']),
  following message returns:

  [example]
  $ curl -i -X POST -d '{"firewall_rule":{"action": "sleeping_beauty", "protocol":"tcp"}}'  -H "x-auth-token:$TOKEN" 192.168.122.181:9696/v2.0/fwaas/firewall_rules

  {"NeutronError": {"message": "Invalid input for action. Reason:
  sleeping_beauty is not in valid_values.", "type": "HTTPBadRequest",
  "detail": ""}}

  A user cannot understand what is valid_values.  Therefore,  validate_values[1] should be fixed.
  In "neutron/api/v2/attributes.py" line 332,  it is called by following format[2]:

  validator(res_dict[attr], attr_vals['validate'][rule])

  If validator is validate_values, 'valid_values_display' which is 3rd arguments is always None.
  Therefore, if an error occurred, it definitely returns "valid_values" in an error message.

  [1]https://github.com/openstack/neutron-lib/blob/master/neutron_lib/api/validators.py#L96
  [2]https://github.com/openstack/neutron/blob/master/neutron/api/v2/attributes.py#L332

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


Follow ups