Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
kamaki
Commits
b45834eb
Commit
b45834eb
authored
Dec 19, 2013
by
Stavros Sachtouris
Browse files
Add --diagnostics to server info
parent
0bf38f8c
Changes
4
Hide whitespace changes
Inline
Side-by-side
kamaki/cli/commands/cyclades.py
View file @
b45834eb
...
...
@@ -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'
]]
...
...
kamaki/clients/cyclades/__init__.py
View file @
b45834eb
...
...
@@ -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'
,
...
...
kamaki/clients/cyclades/rest_api.py
View file @
b45834eb
...
...
@@ -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
)
kamaki/clients/cyclades/test.py
View file @
b45834eb
...
...
@@ -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
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment