summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Finucane <sfinucan@redhat.com>2019-04-05 07:49:38 +0100
committerStephen Finucane <sfinucan@redhat.com>2019-04-08 14:29:40 +0100
commit488dd9940a88c33a5061bde5636e6338602a3a57 (patch)
tree8455b0c1b01ac1c9df5c0508df9dabfb4ff4ea88
parente07be7f338e15da0ed851e1031ba91cdaf4616e3 (diff)
downloadpython-novaclient-488dd9940a88c33a5061bde5636e6338602a3a57.tar.gz
Revert "Fix crashing console-log"
This reverts commit d272d6f3df2610a62f81e2ca26798ea8a6674b06. 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 a9b1125f7ba209887cac36b3c0900cffe2516fa8) (cherry picked from commit 2ca1814a2b4d1e887974a71951b7e744273a43b4)
-rw-r--r--novaclient/v2/shell.py6
1 files changed, 1 insertions, 5 deletions
diff --git a/novaclient/v2/shell.py b/novaclient/v2/shell.py
index 81ab53ca..a0a99d76 100644
--- a/novaclient/v2/shell.py
+++ b/novaclient/v2/shell.py
@@ -19,7 +19,6 @@
from __future__ import print_function
import argparse
-import codecs
import collections
import datetime
import getpass
@@ -2675,10 +2674,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.'))