Revision 8614814c kamaki/utils.py
b/kamaki/utils.py | ||
---|---|---|
31 | 31 |
# interpreted as representing official policies, either expressed |
32 | 32 |
# or implied, of GRNET S.A. |
33 | 33 |
|
34 |
|
|
34 | 35 |
def print_addresses(addresses, margin): |
35 | 36 |
for address in addresses: |
36 | 37 |
if address['id'] == 'public': |
... | ... | |
56 | 57 |
if not d: |
57 | 58 |
return |
58 | 59 |
margin = max(len(key) for key in d) + 1 |
59 |
|
|
60 |
|
|
60 | 61 |
for key, val in sorted(d.items()): |
61 | 62 |
if key in exclude: |
62 | 63 |
continue |
63 |
|
|
64 |
|
|
64 | 65 |
if key == 'addresses': |
65 | 66 |
print '%s:' % 'addresses'.rjust(margin) |
66 | 67 |
print_addresses(val.get('values', []), margin) |
... | ... | |
74 | 75 |
for key, val in val.items(): |
75 | 76 |
print '%s: %s' % (key.rjust(margin + 4), val) |
76 | 77 |
continue |
77 |
|
|
78 |
|
|
78 | 79 |
print '%s: %s' % (key.rjust(margin), val) |
79 | 80 |
|
80 | 81 |
|
Also available in: Unified diff