Skip to content

Commit

Permalink
Revert "Fix crashing console-log"
Browse files Browse the repository at this point in the history
This reverts commit d272d6f. This
worked around a misconfigured environment by forcing stdout to use
UTF-8. This is kind of a hack and it only works in Python 2, breaking
Python 3 [1].

The correct solution to this issue and all Python 2 unicode print issues
is to correctly configuring LC_ALL to use a UTF-8 locale.

[1] https://stackoverflow.com/q/4374455

Change-Id: Iaeec1e74262a35f3de3c81f7013835a6aa6f9029
Closes-Bug: #1823287
(cherry picked from commit a9b1125)
  • Loading branch information
stephenfin committed Apr 8, 2019
1 parent 70ed791 commit 2ca1814
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions novaclient/v2/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from __future__ import print_function

import argparse
import codecs
import collections
import datetime
import getpass
Expand Down Expand Up @@ -2759,10 +2758,7 @@ def do_console_log(cs, args):
"""Get console log output of a server."""
server = _find_server(cs, args.server)
data = server.get_console_output(length=args.length)

if data and data[-1] != '\n':
data += '\n'
codecs.getwriter('utf-8')(sys.stdout).write(data)
print(data)


@utils.arg('server', metavar='<server>', help=_('Name or ID of server.'))
Expand Down

0 comments on commit 2ca1814

Please sign in to comment.