Commit 7ba195e5 authored by Stavros Sachtouris's avatar Stavros Sachtouris
Browse files

Remove links from simple listing

parent d0f431bb
......@@ -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):
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):
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']
......@@ -592,6 +596,8 @@ class network_list(_init_cyclades, _optional_json):
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
......@@ -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)
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