Simplifying get_console_output client interface.
Now instead of doing server.get_console_output()[0]['output'] You can do: server.get_console_output() Change-Id: Ic8a3f435fa0111feaa0d5cd42943dd2c7c243fb9
This commit is contained in:
parent
4d5946afab
commit
d2e054f07a
@ -517,7 +517,9 @@ class ServerManager(local_base.BootingManagerWithFind):
|
||||
you would like to retrieve.
|
||||
:param length: The number of tail loglines you would like to retrieve.
|
||||
"""
|
||||
return self._action('os-getConsoleOutput', server, {'length': length})
|
||||
return self._action('os-getConsoleOutput',
|
||||
server,
|
||||
{'length': length})[1]['output']
|
||||
|
||||
def delete_meta(self, server, keys):
|
||||
"""
|
||||
|
@ -302,7 +302,7 @@ class FakeHTTPClient(base_client.HTTPClient):
|
||||
assert body[action].keys() == ['adminPass']
|
||||
elif action == 'os-getConsoleOutput':
|
||||
assert body[action].keys() == ['length']
|
||||
return (202, "foo")
|
||||
return (202, {'output': 'foo'})
|
||||
else:
|
||||
raise AssertionError("Unexpected server action: %s" % action)
|
||||
return (202, _body)
|
||||
|
@ -202,7 +202,7 @@ class ServersTest(utils.TestCase):
|
||||
cs.assert_called('POST', '/servers/1234/action')
|
||||
|
||||
def test_get_console_output_without_length(self):
|
||||
success = ({'status': 202}, 'foo')
|
||||
success = 'foo'
|
||||
s = cs.servers.get(1234)
|
||||
s.get_console_output()
|
||||
self.assertEqual(s.get_console_output(), success)
|
||||
@ -213,7 +213,8 @@ class ServersTest(utils.TestCase):
|
||||
cs.assert_called('POST', '/servers/1234/action')
|
||||
|
||||
def test_get_console_output_with_length(self):
|
||||
success = ({'status': 202}, 'foo')
|
||||
success = 'foo'
|
||||
|
||||
s = cs.servers.get(1234)
|
||||
s.get_console_output(length=50)
|
||||
self.assertEqual(s.get_console_output(length=50), success)
|
||||
|
Loading…
x
Reference in New Issue
Block a user