← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1956785] [NEW] Duplicate validator TypeError for dict values

 

Public bug reported:

In the below logs I observe that a port update is attempted with
duplicate extra_dhcp_opts. Since the values for extra_dhcp_opts are
dicts the _collect_duplicates() method[1] fails as it attempts to add
dict's to a set.

[1] https://opendev.org/openstack/neutron-
lib/src/branch/master/neutron_lib/api/validators/__init__.py#L76-L91


2022-01-07 12:18:22.854 27 DEBUG neutron.api.v2.base [req-67d0c767-16c3-4bd6-8c7d-455becccaa96 - fake_project_id - - -] Request body: {'port': {'extra_dhcp_opts': [{'opt_name': 'tag:!ipxe6,59', 'opt_value': 'tftp://[fd00:fd00:fd00::1]/undionly.kpxe', 'ip_version': 6}, {'opt_name': 'tag:ipxe6,59', 'opt_value': 'http://[fd00:fd00:fd00::1]:8088/boot.ipxe', 'ip_version': 6}, {'opt_name': 'tag:!ipxe6,59', 'opt_value': 'tftp://[fd00:fd00:fd00::1]/undionly.kpxe', 'ip_version': 6}, {'opt_name': 'tag:ipxe6,59', 'opt_value': 'http://[fd00:fd00:fd00::1]:8088/boot.ipxe', 'ip_version': 6}, {'opt_name': 'tag:!ipxe6,59', 'opt_value': 'tftp://[fd00:fd00:fd00::1]/undionly.kpxe', 'ip_version': 6}, {'opt_name': 'tag:ipxe6,59', 'opt_value': 'http://[fd00:fd00:fd00::1]:8088/boot.ipxe', 'ip_version': 6}, {'opt_name': 'tag:!ipxe6,59', 'opt_value': 'tftp://[fd00:fd00:fd00::1]/undionly.kpxe', 'ip_version': 6}, {'opt_name': 'tag:ipxe6,59', 'opt_value': 'http://[fd00:fd00:fd00::1]:8088/boot.ipxe', 'ip_version': 6}]}} prepare_request_body /usr/lib/python3.6/site-packages/neutron/api/v2/base.py:729

2022-01-07 12:18:22.856 27 WARNING neutron.pecan_wsgi.hooks.body_validation [req-67d0c767-16c3-4bd6-8c7d-455becccaa96 - fake_project_id - - -] An exception happened while processing the request body. The exception message is [unhashable type: 'dict'].
2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation [req-67d0c767-16c3-4bd6-8c7d-455becccaa96 - fake_project_id - - -] PUT failed.: TypeError: unhashable type: 'dict'
2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation Traceback (most recent call last):
2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python3.6/site-packages/pecan/core.py", line 682, in __call__
2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation     controller, args, kwargs = self.find_controller(state)
2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python3.6/site-packages/pecan/core.py", line 858, in find_controller
2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation     controller, args, kw = super(Pecan, self).find_controller(_state)
2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python3.6/site-packages/pecan/core.py", line 550, in find_controller
2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation     self.handle_hooks(self.determine_hooks(controller), 'before', state)
2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python3.6/site-packages/pecan/core.py", line 865, in handle_hooks
2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation     return super(Pecan, self).handle_hooks(hooks, *args, **kw)
2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python3.6/site-packages/pecan/core.py", line 342, in handle_hooks
2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation     result = getattr(hook, hook_type)(*args)
2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python3.6/site-packages/neutron/pecan_wsgi/hooks/body_validation.py", line 71, in before
2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation     raise e
2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python3.6/site-packages/neutron/pecan_wsgi/hooks/body_validation.py", line 67, in before
2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation     allow_bulk=is_create)
2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python3.6/site-packages/neutron/api/v2/base.py", line 776, in prepare_request_body
2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation     attr_ops.convert_values(res_dict, exc_cls=webob.exc.HTTPBadRequest)
2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python3.6/site-packages/neutron_lib/api/attributes.py", line 233, in convert_values
2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation     attr_vals['validate'][rule])
2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python3.6/site-packages/neutron_lib/api/validators/__init__.py", line 513, in validate_any_key_specs_or_none
2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation     msg = _validate_list_of_items(dict_validator, data)
2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python3.6/site-packages/neutron_lib/api/validators/__init__.py", line 110, in _validate_list_of_items
2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation     dups = _collect_duplicates(data)
2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python3.6/site-packages/neutron_lib/api/validators/__init__.py", line 88, in _collect_duplicates
2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation     dups.add(datum)
2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation TypeError: unhashable type: 'dict'
2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation

** Affects: neutron
     Importance: Undecided
         Status: New

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

Title:
  Duplicate validator TypeError for dict values

Status in neutron:
  New

Bug description:
  In the below logs I observe that a port update is attempted with
  duplicate extra_dhcp_opts. Since the values for extra_dhcp_opts are
  dicts the _collect_duplicates() method[1] fails as it attempts to add
  dict's to a set.

  [1] https://opendev.org/openstack/neutron-
  lib/src/branch/master/neutron_lib/api/validators/__init__.py#L76-L91

  
  2022-01-07 12:18:22.854 27 DEBUG neutron.api.v2.base [req-67d0c767-16c3-4bd6-8c7d-455becccaa96 - fake_project_id - - -] Request body: {'port': {'extra_dhcp_opts': [{'opt_name': 'tag:!ipxe6,59', 'opt_value': 'tftp://[fd00:fd00:fd00::1]/undionly.kpxe', 'ip_version': 6}, {'opt_name': 'tag:ipxe6,59', 'opt_value': 'http://[fd00:fd00:fd00::1]:8088/boot.ipxe', 'ip_version': 6}, {'opt_name': 'tag:!ipxe6,59', 'opt_value': 'tftp://[fd00:fd00:fd00::1]/undionly.kpxe', 'ip_version': 6}, {'opt_name': 'tag:ipxe6,59', 'opt_value': 'http://[fd00:fd00:fd00::1]:8088/boot.ipxe', 'ip_version': 6}, {'opt_name': 'tag:!ipxe6,59', 'opt_value': 'tftp://[fd00:fd00:fd00::1]/undionly.kpxe', 'ip_version': 6}, {'opt_name': 'tag:ipxe6,59', 'opt_value': 'http://[fd00:fd00:fd00::1]:8088/boot.ipxe', 'ip_version': 6}, {'opt_name': 'tag:!ipxe6,59', 'opt_value': 'tftp://[fd00:fd00:fd00::1]/undionly.kpxe', 'ip_version': 6}, {'opt_name': 'tag:ipxe6,59', 'opt_value': 'http://[fd00:fd00:fd00::1]:8088/boot.ipxe', 'ip_version': 6}]}} prepare_request_body /usr/lib/python3.6/site-packages/neutron/api/v2/base.py:729

  2022-01-07 12:18:22.856 27 WARNING neutron.pecan_wsgi.hooks.body_validation [req-67d0c767-16c3-4bd6-8c7d-455becccaa96 - fake_project_id - - -] An exception happened while processing the request body. The exception message is [unhashable type: 'dict'].
  2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation [req-67d0c767-16c3-4bd6-8c7d-455becccaa96 - fake_project_id - - -] PUT failed.: TypeError: unhashable type: 'dict'
  2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation Traceback (most recent call last):
  2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python3.6/site-packages/pecan/core.py", line 682, in __call__
  2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation     controller, args, kwargs = self.find_controller(state)
  2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python3.6/site-packages/pecan/core.py", line 858, in find_controller
  2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation     controller, args, kw = super(Pecan, self).find_controller(_state)
  2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python3.6/site-packages/pecan/core.py", line 550, in find_controller
  2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation     self.handle_hooks(self.determine_hooks(controller), 'before', state)
  2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python3.6/site-packages/pecan/core.py", line 865, in handle_hooks
  2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation     return super(Pecan, self).handle_hooks(hooks, *args, **kw)
  2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python3.6/site-packages/pecan/core.py", line 342, in handle_hooks
  2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation     result = getattr(hook, hook_type)(*args)
  2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python3.6/site-packages/neutron/pecan_wsgi/hooks/body_validation.py", line 71, in before
  2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation     raise e
  2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python3.6/site-packages/neutron/pecan_wsgi/hooks/body_validation.py", line 67, in before
  2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation     allow_bulk=is_create)
  2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python3.6/site-packages/neutron/api/v2/base.py", line 776, in prepare_request_body
  2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation     attr_ops.convert_values(res_dict, exc_cls=webob.exc.HTTPBadRequest)
  2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python3.6/site-packages/neutron_lib/api/attributes.py", line 233, in convert_values
  2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation     attr_vals['validate'][rule])
  2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python3.6/site-packages/neutron_lib/api/validators/__init__.py", line 513, in validate_any_key_specs_or_none
  2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation     msg = _validate_list_of_items(dict_validator, data)
  2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python3.6/site-packages/neutron_lib/api/validators/__init__.py", line 110, in _validate_list_of_items
  2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation     dups = _collect_duplicates(data)
  2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python3.6/site-packages/neutron_lib/api/validators/__init__.py", line 88, in _collect_duplicates
  2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation     dups.add(datum)
  2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation TypeError: unhashable type: 'dict'
  2022-01-07 12:18:22.858 27 ERROR neutron.pecan_wsgi.hooks.translation

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



Follow ups