Fix crashing console-log
Because of encoding issue, the "nova console-log" is prone to a stack dump, as explained in the bug report. This patch sets the encoding output of stdout to utf8 before attempting to print in it. Change-Id: I63bc3dc8807021f5a97f58b0fe13a10d93688c7e Closes-Bug: 1746534
This commit is contained in:
parent
5de74bef5c
commit
d272d6f3df
|
@ -19,6 +19,7 @@
|
|||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import codecs
|
||||
import collections
|
||||
import datetime
|
||||
import getpass
|
||||
|
@ -2594,7 +2595,10 @@ 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)
|
||||
print(data)
|
||||
|
||||
if data and data[-1] != '\n':
|
||||
data += '\n'
|
||||
codecs.getwriter('utf-8')(sys.stdout).write(data)
|
||||
|
||||
|
||||
@utils.arg('server', metavar='<server>', help=_('Name or ID of server.'))
|
||||
|
|
Loading…
Reference in New Issue