Skip to content

Commit 9a17356

Browse files
thomasgoirandDean Troyer
authored andcommitted
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
1 parent 25e60a4 commit 9a17356

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

openstackclient/compute/v2/console.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515

1616
"""Compute v2 Console action implementations"""
1717

18-
import sys
19-
2018
from osc_lib.cli import parseractions
2119
from osc_lib.command import command
2220
from osc_lib import utils
@@ -60,7 +58,10 @@ def take_action(self, parsed_args):
6058
length += 1
6159

6260
data = server.get_console_output(length=length)
63-
sys.stdout.write(data)
61+
62+
if data and data[-1] != '\n':
63+
data += '\n'
64+
self.app.stdout.write(data)
6465

6566

6667
class ShowConsoleURL(command.ShowOne):

0 commit comments

Comments
 (0)