Fix crashing "console log show"
Because of encoding issue, the "openstack console show log" is prone to a stack dump, as explained in the bug report. Use the stdout handle that has already been set up by cliff's App class with a sane default encoding. Change-Id: I4d8b0df7f16ee0463e638bb11276220e5b92023b Closes-Bug: 1747862
This commit is contained in:
parent
25e60a4bf1
commit
9a17356854
@ -15,8 +15,6 @@
|
|||||||
|
|
||||||
"""Compute v2 Console action implementations"""
|
"""Compute v2 Console action implementations"""
|
||||||
|
|
||||||
import sys
|
|
||||||
|
|
||||||
from osc_lib.cli import parseractions
|
from osc_lib.cli import parseractions
|
||||||
from osc_lib.command import command
|
from osc_lib.command import command
|
||||||
from osc_lib import utils
|
from osc_lib import utils
|
||||||
@ -60,7 +58,10 @@ class ShowConsoleLog(command.Command):
|
|||||||
length += 1
|
length += 1
|
||||||
|
|
||||||
data = server.get_console_output(length=length)
|
data = server.get_console_output(length=length)
|
||||||
sys.stdout.write(data)
|
|
||||||
|
if data and data[-1] != '\n':
|
||||||
|
data += '\n'
|
||||||
|
self.app.stdout.write(data)
|
||||||
|
|
||||||
|
|
||||||
class ShowConsoleURL(command.ShowOne):
|
class ShowConsoleURL(command.ShowOne):
|
||||||
|
Loading…
Reference in New Issue
Block a user