This change would be like going back to the situation
(https://review.openstack.org/#/c/343799/25/neutron_lib/api/validators.py)
before [1], where the valid values were displayed in the message. Citing
feedback from the patchset: "Based on the work done in [1], IIRC we
intentionally display the static string 'valid_values' if
valid_values_display is not given as valid_values could be excessively
large or even contain values that shouldn't be exposed.

[1] https://review.openstack.org/#/c/343799/

** Changed in: neutron
       Status: In Progress => Opinion

-- 
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 in an error message should be visible

Status in neutron:
  Opinion

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

-- 
Mailing list: https://launchpad.net/~yahoo-eng-team
Post to     : yahoo-eng-team@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yahoo-eng-team
More help   : https://help.launchpad.net/ListHelp

Reply via email to