← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1638664] [NEW] OVO MACAddress field isn't serializable

 

Public bug reported:

The OVO MACAddress field can't be serialized to JSON because it is
represented as a EUI object from netaddr without a to_primitive method.

This is what happens if you try to json encode an EUI object.

>>> json.dumps({'mac-address': netaddr.EUI('AA-BB-CC-DD-EE-FF')})
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/json/__init__.py", line 244, in dumps
    return _default_encoder.encode(obj)
  File "/usr/lib/python2.7/json/encoder.py", line 207, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python2.7/json/encoder.py", line 270, in iterencode
    return _iterencode(o, 0)
  File "/usr/lib/python2.7/json/encoder.py", line 184, in default
    raise TypeError(repr(o) + " is not JSON serializable")
TypeError: EUI('AA-BB-CC-DD-EE-FF') is not JSON serializable

** Affects: neutron
     Importance: Undecided
     Assignee: Kevin Benton (kevinbenton)
         Status: New

** Changed in: neutron
     Assignee: (unassigned) => Kevin Benton (kevinbenton)

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

Title:
  OVO MACAddress field isn't serializable

Status in neutron:
  New

Bug description:
  The OVO MACAddress field can't be serialized to JSON because it is
  represented as a EUI object from netaddr without a to_primitive
  method.

  This is what happens if you try to json encode an EUI object.

  >>> json.dumps({'mac-address': netaddr.EUI('AA-BB-CC-DD-EE-FF')})
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/usr/lib/python2.7/json/__init__.py", line 244, in dumps
      return _default_encoder.encode(obj)
    File "/usr/lib/python2.7/json/encoder.py", line 207, in encode
      chunks = self.iterencode(o, _one_shot=True)
    File "/usr/lib/python2.7/json/encoder.py", line 270, in iterencode
      return _iterencode(o, 0)
    File "/usr/lib/python2.7/json/encoder.py", line 184, in default
      raise TypeError(repr(o) + " is not JSON serializable")
  TypeError: EUI('AA-BB-CC-DD-EE-FF') is not JSON serializable

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


Follow ups