File 0001-Fix-the-unlimited-length-of-console-log.patch of Package python-novaclient

From 7acbc5f1f8d6d8079f7aaf5e60c8b7a2ee3a5932 Mon Sep 17 00:00:00 2001
From: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>
Date: Tue, 15 Apr 2014 09:47:51 +0900
Subject: [PATCH] Fix the unlimited length of console-log

Since the commit Idf88a238d1b0e545ebab5be872269b1b1030cc56 of Nova,
the unlimited length has been changed to -1 for API consistency.

This patch applies it to novaclient.

Change-Id: I581609a55f081184ad9d791ba38d78fa30d298a6
Closes-Bug: #1295426
---
 novaclient/tests/v3/test_servers.py | 9 ++++++---
 novaclient/v3/servers.py            | 5 +++++
 2 files changed, 11 insertions(+), 3 deletions(-)

Index: python-novaclient-2.17.0/novaclient/tests/v3/test_servers.py
===================================================================
--- python-novaclient-2.17.0.orig/novaclient/tests/v3/test_servers.py
+++ python-novaclient-2.17.0/novaclient/tests/v3/test_servers.py
@@ -299,7 +299,8 @@ class ServersTest(utils.TestCase):
 
         cs.servers.get_console_output(s)
         self.assertEqual(cs.servers.get_console_output(s), success)
-        cs.assert_called('POST', '/servers/1234/action')
+        cs.assert_called('POST', '/servers/1234/action',
+                         {'get_console_output': {'length': -1}})
 
     def test_get_console_output_with_length(self):
         success = 'foo'
@@ -307,11 +308,13 @@ class ServersTest(utils.TestCase):
         s = cs.servers.get(1234)
         s.get_console_output(length=50)
         self.assertEqual(s.get_console_output(length=50), success)
-        cs.assert_called('POST', '/servers/1234/action')
+        cs.assert_called('POST', '/servers/1234/action',
+                         {'get_console_output': {'length': 50}})
 
         cs.servers.get_console_output(s, length=50)
         self.assertEqual(cs.servers.get_console_output(s, length=50), success)
-        cs.assert_called('POST', '/servers/1234/action')
+        cs.assert_called('POST', '/servers/1234/action',
+                         {'get_console_output': {'length': 50}})
 
     def test_get_password(self):
         s = cs.servers.get(1234)
Index: python-novaclient-2.17.0/novaclient/v3/servers.py
===================================================================
--- python-novaclient-2.17.0.orig/novaclient/v3/servers.py
+++ python-novaclient-2.17.0/novaclient/v3/servers.py
@@ -894,6 +894,11 @@ class ServerManager(base.BootingManagerW
                         you would like to retrieve.
         :param length: The number of tail loglines you would like to retrieve.
         """
+        if length is None:
+            # NOTE: On v3 get_console_output API, -1 means an unlimited length.
+            # Here translates None, which means an unlimited in the internal
+            # implementation, to -1.
+            length = -1
         return self._action('get_console_output',
                             server, {'length': length})[1]['output']
 
openSUSE Build Service is sponsored by