Revision 75c3fc42 kamaki/cli/commands/cyclades_cli.py

b/kamaki/cli/commands/cyclades_cli.py
113 113
    def _print(self, server):
114 114
        addr_dict = {}
115 115
        if 'attachments' in server:
116
            for addr in server['attachments']['values']:
116
            atts = server.pop('attachments')
117
            for addr in atts['values']:
117 118
                ips = addr.pop('values', [])
118 119
                for ip in ips:
119 120
                    addr['IPv%s' % ip['version']] = ip['addr']
120 121
                if 'firewallProfile' in addr:
121 122
                    addr['firewall'] = addr.pop('firewallProfile')
122 123
                addr_dict[addr.pop('id')] = addr
123
            server['attachments'] = addr_dict if addr_dict is not {} else None
124
            server['attachments'] = addr_dict if addr_dict else None
124 125
        if 'metadata' in server:
125 126
            server['metadata'] = server['metadata']['values']
126 127
        print_dict(server, ident=2)

Also available in: Unified diff