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
7ba195e5
Commit
7ba195e5
authored
Jun 19, 2013
by
Stavros Sachtouris
Browse files
Remove links from simple listing
parent
d0f431bb
Changes
2
Hide whitespace changes
Inline
Side-by-side
kamaki/cli/commands/cyclades.py
View file @
7ba195e5
...
...
@@ -33,7 +33,7 @@
from
kamaki.cli
import
command
from
kamaki.cli.command_tree
import
CommandTree
from
kamaki.cli.utils
import
print_dict
from
kamaki.cli.utils
import
print_dict
,
remove_from_items
from
kamaki.cli.errors
import
raiseCLIError
,
CLISyntaxError
,
CLIBaseUrlError
from
kamaki.clients.cyclades
import
CycladesClient
,
ClientError
from
kamaki.cli.argument
import
FlagArgument
,
ValueArgument
,
KeyValueArgument
...
...
@@ -118,6 +118,8 @@ class server_list(_init_cyclades, _optional_json):
@
errors
.
cyclades
.
date
def
_run
(
self
):
servers
=
self
.
client
.
list_servers
(
self
[
'detail'
],
self
[
'since'
])
if
not
(
self
[
'detail'
]
or
self
[
'json_output'
]):
remove_from_items
(
servers
,
'links'
)
kwargs
=
dict
(
with_enumeration
=
self
[
'enum'
])
if
self
[
'more'
]:
...
...
@@ -527,6 +529,8 @@ class flavor_list(_init_cyclades, _optional_json):
@
errors
.
cyclades
.
connection
def
_run
(
self
):
flavors
=
self
.
client
.
list_flavors
(
self
[
'detail'
])
if
not
(
self
[
'detail'
]
or
self
[
'json_output'
]):
remove_from_items
(
flavors
,
'links'
)
pg_size
=
10
if
self
[
'more'
]
and
not
self
[
'limit'
]
else
self
[
'limit'
]
self
.
_print
(
flavors
,
...
...
@@ -592,6 +596,8 @@ class network_list(_init_cyclades, _optional_json):
@
errors
.
cyclades
.
connection
def
_run
(
self
):
networks
=
self
.
client
.
list_networks
(
self
[
'detail'
])
if
not
(
self
[
'detail'
]
or
self
[
'json_output'
]):
remove_from_items
(
networks
,
'links'
)
kwargs
=
dict
(
with_enumeration
=
self
[
'enum'
])
if
self
[
'more'
]:
kwargs
[
'page_size'
]
=
self
[
'limit'
]
or
10
...
...
kamaki/cli/utils.py
View file @
7ba195e5
...
...
@@ -498,3 +498,9 @@ def get_path_size(testpath):
if
path
.
isfile
(
f
):
total_size
+=
path
.
getsize
(
f
)
return
total_size
def
remove_from_items
(
list_of_dicts
,
key_to_remove
):
for
item
in
list_of_dicts
:
assert
isinstance
(
item
,
dict
),
'Item %s not a dict'
%
item
item
.
pop
(
key_to_remove
,
None
)
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