Logs collection raises TypeError on Python 3

Bug #1668533 reported by zack chen on 2017-02-28
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ironic-python-agent
Fix Released
High
zack chen

Bug Description

When fedora distro is used as the deploy image,ironic-python-agent raise an TypeError and process exits.Following is the log.

2017-02-28 08:32:12.062 1569 CRITICAL ironic-python-agent [-] TypeError: b'H4sIAIs1tVgC/+y9f3/aSLI3ev6eV9E3+znX9sZgtX7Dc7xnMcaJN8FmjZ2Z3UwerpAEaCwkjSQce179rWpJIDB2rB/teLJmxgGEVN/u6uqq6uru6iD6L+4vAV6qLLN3eG2+iwL8RiVBUURJVKkE1zVFof9FhP96htciio2QkFoqma/cn+R1NexdkOQ1OD0m/90dXJH/7vf6eOHT8N/w78VwSC4v/5XcM7zsXOI/F5fw5fK03yPd836/c3b8U+j7cUpIkVVChKaQ/kNURdAJoWpLJXF8RxNC0Vv4WW+LeIPQFgRyEI0d78CY2nAPaT.....................................IUpShFKUpRilKUomRR/g+Q+vVzAEAGAA==' is not JSON serializable
2017-02-28 08:32:12.062 1569 ERROR ironic-python-agent Traceback (most recent call last):
2017-02-28 08:32:12.062 1569 ERROR ironic-python-agent File "/usr/share/ironic-python-agent/venv/bin/ironic-python-agent", line 11, in <module>
2017-02-28 08:32:12.062 1569 ERROR ironic-python-agent sys.exit(run())
2017-02-28 08:32:12.062 1569 ERROR ironic-python-agent File "/usr/share/ironic-python-agent/venv/lib/python3.5/site-packages/ironic_python_agent/cmd/agent.py", line 48, in run
2017-02-28 08:32:12.062 1569 ERROR ironic-python-agent CONF.hardware_initialization_delay).run()
2017-02-28 08:32:12.062 1569 ERROR ironic-python-agent File "/usr/share/ironic-python-agent/venv/lib/python3.5/site-packages/ironic_python_agent/agent.py", line 339, in run
2017-02-28 08:32:12.062 1569 ERROR ironic-python-agent uuid = inspector.inspect()
2017-02-28 08:32:12.062 1569 ERROR ironic-python-agent File "/usr/share/ironic-python-agent/venv/lib/python3.5/site-packages/ironic_python_agent/inspector.py", line 92, in inspect
2017-02-28 08:32:12.062 1569 ERROR ironic-python-agent resp = call_inspector(data, failures)
2017-02-28 08:32:12.062 1569 ERROR ironic-python-agent File "/usr/share/ironic-python-agent/venv/lib/python3.5/site-packages/ironic_python_agent/inspector.py", line 117, in call_inspector
2017-02-28 08:32:12.062 1569 ERROR ironic-python-agent data = encoder.encode(data)
2017-02-28 08:32:12.062 1569 ERROR ironic-python-agent File "/usr/share/ironic-python-agent/venv/lib/python3.5/site-packages/ironic_python_agent/encoding.py", line 60, in encode
2017-02-28 08:32:12.062 1569 ERROR ironic-python-agent return super(RESTJSONEncoder, self).encode(o) + delimiter
2017-02-28 08:32:12.062 1569 ERROR ironic-python-agent File "/usr/lib64/python3.5/json/encoder.py", line 198, in encode
2017-02-28 08:32:12.062 1569 ERROR ironic-python-agent chunks = self.iterencode(o, _one_shot=True)
2017-02-28 08:32:12.062 1569 ERROR ironic-python-agent File "/usr/lib64/python3.5/json/encoder.py", line 256, in iterencode
2017-02-28 08:32:12.062 1569 ERROR ironic-python-agent return _iterencode(o, 0)
2017-02-28 08:32:12.062 1569 ERROR ironic-python-agent File "/usr/share/ironic-python-agent/venv/lib/python3.5/site-packages/ironic_python_agent/encoding.py", line 72, in default
2017-02-28 08:32:12.062 1569 ERROR ironic-python-agent return json.JSONEncoder.default(self, o)
2017-02-28 08:32:12.062 1569 ERROR ironic-python-agent File "/usr/lib64/python3.5/json/encoder.py", line 179, in default
2017-02-28 08:32:12.062 1569 ERROR ironic-python-agent raise TypeError(repr(o) + " is not JSON serializable")
2017-02-28 08:32:12.062 1569 ERROR ironic-python-agent TypeError: b'H4sIAIs1tVgC/+y9f3/aSLI3ev6eV9E3+znX9sZgtX7Dc7xnMcaJN8FmjZ2Z3UwerpAEaCwkjSQce179rWpJIDB2rB/teLJmxgGEVN/u6uqq6uru6iD6L+4vAV6qLLN3eG2+iwL8RiVBUURJVKkE1zVFof9FhP96htciio2QkFoqma/cn+R1NexdkOQ1OD0m/90dXJH/7vf6eOHT8N/w78VwSC4v/5XcM7zsXOI/F5fw5fK03yPd836/c3b8U+j7cUpIkVVChKaQ/kNURdAJoWpLJXF..

zack chen (zackchen) on 2017-02-28
Changed in ironic-python-agent:
assignee: nobody → zack chen (zackchen)
Changed in ironic-python-agent:
status: New → In Progress
Dmitry Tantsur (divius) on 2017-03-13
summary: - collected logs encode to 'json',raise TypeError
+ Logs collection raises TypeError on Python 3
Changed in ironic-python-agent:
importance: Undecided → High
tags: added: low-hanging-fruit

Reviewed: https://review.openstack.org/438901
Committed: https://git.openstack.org/cgit/openstack/ironic-python-agent/commit/?id=000eaa355472f63ae112cf1e1dcedc2c094ed5c1
Submitter: Jenkins
Branch: master

commit 000eaa355472f63ae112cf1e1dcedc2c094ed5c1
Author: zackchen <email address hidden>
Date: Tue Feb 28 17:55:26 2017 +0800

    Fix logs encoding in py3

    Make sure that logs are encoded as text (not byte strings) in
    python3 to allow theirs serialization in JSON.

    Closes-Bug: #1668533

    Change-Id: I3d0d87ca766146457d905f89c26331a415bd54f8

Changed in ironic-python-agent:
status: In Progress → Fix Released

This issue was fixed in the openstack/ironic-python-agent 2.1.0 release.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers