Commit 9fad317e authored by Stavros Sachtouris's avatar Stavros Sachtouris

Add --diagnostics to server info

Conflicts:

	kamaki/cli/commands/cyclades.py
parent 2ed50f2c
......@@ -289,6 +289,8 @@ class server_info(_init_cyclades, _optional_json):
elif self['stats']:
self._print(
self.client.get_server_stats(server_id), self.print_dict)
elif self['diagnostics']:
self._print(self.client.get_server_diagnostics(server_id))
else:
vm = self.client.get_server_details(server_id)
uuids = self._uuids2usernames([vm['user_id'], vm['tenant_id']])
......
......@@ -121,6 +121,15 @@ class CycladesClient(CycladesRestClient, Waiter):
r = self.servers_stats_get(server_id)
return r.json['stats']
def get_server_diagnostics(self, server_id):
"""
:param server_id: integer (str or int)
:returns: (list)
"""
r = self.servers_diagnostics_get(server_id)
return r.json
def wait_server(
self, server_id,
current_status='BUILD',
......
......@@ -42,3 +42,8 @@ class CycladesRestClient(ComputeClient):
"""GET base_url/servers/<server_id>/stats"""
path = path4url('servers', server_id, 'stats')
return self.get(path, success=200, **kwargs)
def servers_diagnostics_get(self, server_id, **kwargs):
"""GET base_url/servers/<server_id>/diagnostics"""
path = path4url('servers', server_id, 'diagnostics')
return self.get(path, success=200, **kwargs)
......@@ -106,6 +106,14 @@ class CycladesRestClient(TestCase):
get.assert_called_once_with(
'/servers/%s/stats' % server_id, success=200)
@patch('kamaki.clients.Client.get', return_value='ret')
def test_servers_diagnostics_get(self, get):
server_id = 'server id'
self.assertEqual(
self.client.servers_diagnostics_get(server_id), 'ret')
get.assert_called_once_with(
'/servers/%s/diagnostics' % server_id, success=200)
class CycladesNetworkClient(TestCase):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment