From 3b57117f8efc0c945f730c5e8a598768ac774114 Mon Sep 17 00:00:00 2001
From: Yejia Xu <yejia@unitedstack.com>
Date: Wed, 7 May 2014 01:49:15 +0000
Subject: [PATCH] Display all server log when --lines option is None

Without --lines option, `console log show xxx`
cmd will break.

Change-Id: I4027aacac245e6916c1808fd9f878fb708c8a5f0
Closes-Bug: #1316870
---
 openstackclient/compute/v2/console.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/openstackclient/compute/v2/console.py b/openstackclient/compute/v2/console.py
index 8f49c5134a..032168b906 100644
--- a/openstackclient/compute/v2/console.py
+++ b/openstackclient/compute/v2/console.py
@@ -55,9 +55,13 @@ class ShowConsoleLog(command.Command):
             compute_client.servers,
             parsed_args.server,
         )
-        # NOTE(dtroyer): get_console_output() appears to shortchange the
-        #                output by one line
-        data = server.get_console_output(length=parsed_args.lines + 1)
+        length = parsed_args.lines
+        if length:
+            # NOTE(dtroyer): get_console_output() appears to shortchange the
+            #                output by one line
+            length += 1
+
+        data = server.get_console_output(length=length)
         sys.stdout.write(data)
         return