Commit b45834eb authored by Stavros Sachtouris's avatar Stavros Sachtouris
Browse files

Add --diagnostics to server info

parent 0bf38f8c
......@@ -270,7 +270,8 @@ class server_info(_init_cyclades, _optional_json):
vnc=FlagArgument(
'Show VNC connection information (valid for a short period)',
'--vnc-credentials'),
stats=FlagArgument('Get URLs for server statistics', '--stats')
stats=FlagArgument('Get URLs for server statistics', '--stats'),
diagnostics=FlagArgument('Diagnostic information', '--diagnostics')
)
@errors.generic.all
......@@ -290,6 +291,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:
uuids = self._uuids2usernames([vm['user_id'], vm['tenant_id']])
vm['user_id'] += ' (%s)' % uuids[vm['user_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