]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Ensure to decode bytes or fail
authorCedric Brandily <zzelle@gmail.com>
Tue, 6 Oct 2015 20:58:07 +0000 (22:58 +0200)
committerCedric Brandily <zzelle@gmail.com>
Wed, 4 Nov 2015 06:03:12 +0000 (07:03 +0100)
commit4e4706e0f5652fde452aca3c69a3a08e62513e2f
treec7ddb278836bd882597bdad3cfa4fe78ab387582
parentfd7f84b20b30b15445725c39bc5f8b1218de25d4
Ensure to decode bytes or fail

The commit 048316e98114145ad19285cdeedd0040b59a66f8 introduces the
pattern:

  if isinstance(line, bytes):
    try:
      line = line.decode(encoding='utf-8')
    except UnicodeError:
      pass
  # concat line with a string

which is not working in PY3K if an UnicodeError is raised because line
is (silently) not decoded and concatened to a string.

This change ensures to return a text object or to raise an error.

Closes-Bug: #1503415
Blueprint: neutron-python3
Change-Id: I16b8013f33aa3efad65be8040d3210120e047bbd
neutron/agent/linux/utils.py
neutron/agent/windows/utils.py
neutron/tests/unit/agent/linux/test_utils.py