upgrade-env fails when LC_ALL is empty

Bug #1499727 reported by sryabin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fuel for OpenStack
Won't Fix
Wishlist
Unassigned
Mitaka
Won't Fix
Low
Registry Administrators
Newton
Won't Fix
Wishlist
Registry Administrators

Bug Description

Step for reproduce:

[root@fuel bin]# LC_ALL="" octane upgrade-env 1
DEPRECATION WARNING: /etc/fuel/client/config.yaml exists and will be used as the source for settings. This behavior is deprecated. Please specify the path to your custom settings file in the FUELCLIENT_CUSTOM_SETTINGS environment variable.
2015-09-25 12:48:38 INFO octane.util.ssh Creating new SSH connection to node 2
2015-09-25 12:48:38 INFO paramiko.transport Connected (version 2.0, client OpenSSH_6.6.1p1)
2015-09-25 12:48:39 INFO paramiko.transport Authentication (publickey) successful!
2015-09-25 12:48:39 INFO paramiko.transport Secsh channel 1 opened.
2015-09-25 12:48:39 INFO octane.util.subprocess Started process bash[at node-2]: bash -c '. /root/openrc;' 'keystone tenant-list | ' 'awk -F\| '"'"'\$2 ~ /id/{print \$3}'"'"' | tr -d \ '
2015-09-25 12:48:39 INFO octane.util.subprocess Process bash finished with return value 0
Traceback (most recent call last):
  File "/usr/lib64/python2.6/logging/__init__.py", line 799, in emit
    stream.write(fs % msg.encode("UTF-8"))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 63: ordinal not in range(128)

sryabin (sryabin)
Changed in fuel:
assignee: nobody → Fuel Octane Dev Team (fuel-octane)
Revision history for this message
Yuriy Taraday (yorik-sar) wrote :

Here's what leads to this problem:

- some IOError happens;
- IOError gets string associated with errno value based on current locale (which just happend to be ru_RU.UTF-8), gets UTF-8-encoded str object;
- cliff catches this IOError in "err" variable and does "log.error(err)";
- some dozen layers down we end up in StreamHandler.emit method;
- it calls "formatter.format(msg)" (msg is still IOError here) and gets that str object;
- seeing that it's not a unicode, emit() then does "'%s\n' % msg" which succeeds in adding a newline to the string;
- then it passes it to stream.write();
- stream has 'UTF-8' encoding set, so first thing it does is "self.encode(object, self.errors)" which expects object to be a unicode string, but it's not, so it tries implicitly convert it with ASCII encdoding and blows up;
- emit() has nothing better to do but to try "msg.encode('utf-8')" in exception handler, which obviously blows up as well;
- we have new bug in Launchpad.

We should probably convert all messages passed to emit() to Unicode with UTF-8 encoding (or current system encoding) ourselves.

Changed in fuel:
status: New → Confirmed
Changed in fuel:
milestone: none → 8.0
importance: Undecided → High
tags: added: module-octane
Changed in fuel:
importance: High → Medium
Dmitry Pyzhov (dpyzhov)
tags: added: area-octane
Dmitry Pyzhov (dpyzhov)
tags: added: area-python
removed: area-octane
Dmitry Pyzhov (dpyzhov)
tags: added: team-upgrades
Revision history for this message
Dmitry Pyzhov (dpyzhov) wrote :

We passed SCF for 8.0. Moving bug to 9.0.

Changed in fuel:
milestone: 8.0 → 9.0
Revision history for this message
Bug Checker Bot (bug-checker) wrote : Autochecker

(This check performed automatically)
Please, make sure that bug description contains the following sections filled in with the appropriate data related to the bug you are describing:

actual result

expected result

steps to reproduce

For more detailed information on the contents of each of the listed sections see https://wiki.openstack.org/wiki/Fuel/How_to_contribute#Here_is_how_you_file_a_bug

tags: added: need-info
Ilya Kharin (akscram)
Changed in fuel:
status: Confirmed → Won't Fix
Curtis Hovey (sinzui)
Changed in fuel:
assignee: Registry Administrators (registry) → nobody
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.