Revision d09bc886

b/kamaki/cli/commands/cyclades.py
33 33

  
34 34
from kamaki.cli import command
35 35
from kamaki.cli.command_tree import CommandTree
36
from kamaki.cli.utils import print_dict
36
from kamaki.cli.utils import print_dict, remove_from_items
37 37
from kamaki.cli.errors import raiseCLIError, CLISyntaxError, CLIBaseUrlError
38 38
from kamaki.clients.cyclades import CycladesClient, ClientError
39 39
from kamaki.cli.argument import FlagArgument, ValueArgument, KeyValueArgument
......
118 118
    @errors.cyclades.date
119 119
    def _run(self):
120 120
        servers = self.client.list_servers(self['detail'], self['since'])
121
        if not (self['detail'] or self['json_output']):
122
            remove_from_items(servers, 'links')
121 123

  
122 124
        kwargs = dict(with_enumeration=self['enum'])
123 125
        if self['more']:
......
527 529
    @errors.cyclades.connection
528 530
    def _run(self):
529 531
        flavors = self.client.list_flavors(self['detail'])
532
        if not (self['detail'] or self['json_output']):
533
            remove_from_items(flavors, 'links')
530 534
        pg_size = 10 if self['more'] and not self['limit'] else self['limit']
531 535
        self._print(
532 536
            flavors,
......
592 596
    @errors.cyclades.connection
593 597
    def _run(self):
594 598
        networks = self.client.list_networks(self['detail'])
599
        if not (self['detail'] or self['json_output']):
600
            remove_from_items(networks, 'links')
595 601
        kwargs = dict(with_enumeration=self['enum'])
596 602
        if self['more']:
597 603
            kwargs['page_size'] = self['limit'] or 10
b/kamaki/cli/utils.py
498 498
            if path.isfile(f):
499 499
                total_size += path.getsize(f)
500 500
    return total_size
501

  
502

  
503
def remove_from_items(list_of_dicts, key_to_remove):
504
    for item in list_of_dicts:
505
        assert isinstance(item, dict), 'Item %s not a dict' % item
506
        item.pop(key_to_remove, None)

Also available in: Unified diff