Revision cf115aed kamaki/cli/commands/cyclades.py
b/kamaki/cli/commands/cyclades.py | ||
---|---|---|
292 | 292 |
@errors.cyclades.connection |
293 | 293 |
@errors.cyclades.server_id |
294 | 294 |
def _run(self, server_id): |
295 |
self._print(self.client.get_server_details(server_id), print_dict) |
|
295 |
vm = self.client.get_server_details(server_id) |
|
296 |
uuids = self._uuids2usernames([vm['user_id'], vm['tenant_id']]) |
|
297 |
vm['user_id'] += ' (%s)' % uuids[vm['user_id']] |
|
298 |
vm['tenant_id'] += ' (%s)' % uuids[vm['tenant_id']] |
|
299 |
self._print(vm, print_dict) |
|
296 | 300 |
|
297 | 301 |
def main(self, server_id): |
298 | 302 |
super(self.__class__, self)._run() |
... | ... | |
355 | 359 |
def _run(self, name, flavor_id, image_id): |
356 | 360 |
r = self.client.create_server( |
357 | 361 |
name, int(flavor_id), image_id, self['personality']) |
362 |
usernames = self._uuids2usernames([r['user_id'], r['tenant_id']]) |
|
363 |
r['user_id'] += ' (%s)' % usernames[r['user_id']] |
|
364 |
r['tenant_id'] += ' (%s)' % usernames[r['tenant_id']] |
|
358 | 365 |
self._print(r, print_dict) |
359 | 366 |
if self['wait']: |
360 | 367 |
self._wait(r['id'], r['status']) |
... | ... | |
781 | 788 |
self._run(flavor_id=flavor_id) |
782 | 789 |
|
783 | 790 |
|
791 |
def _add_name(self, net): |
|
792 |
user_id, tenant_id, uuids = net['user_id'], net['tenant_id'], [] |
|
793 |
if user_id: |
|
794 |
uuids.append(user_id) |
|
795 |
if tenant_id: |
|
796 |
uuids.append(tenant_id) |
|
797 |
if uuids: |
|
798 |
usernames = self._uuids2usernames(uuids) |
|
799 |
if user_id: |
|
800 |
net['user_id'] += ' (%s)' % usernames[user_id] |
|
801 |
if tenant_id: |
|
802 |
net['tenant_id'] += ' (%s)' % usernames[tenant_id] |
|
803 |
|
|
804 |
|
|
784 | 805 |
@command(network_cmds) |
785 | 806 |
class network_info(_init_cyclades, _optional_json): |
786 | 807 |
"""Detailed information on a network |
... | ... | |
792 | 813 |
@errors.cyclades.network_id |
793 | 814 |
def _run(self, network_id): |
794 | 815 |
network = self.client.get_network_details(int(network_id)) |
816 |
_add_name(self, network) |
|
795 | 817 |
self._print(network, print_dict, exclude=('id')) |
796 | 818 |
|
797 | 819 |
def main(self, network_id): |
... | ... | |
920 | 942 |
gateway=self['gateway'], |
921 | 943 |
dhcp=self['dhcp'], |
922 | 944 |
type=self['type']) |
945 |
_add_name(self, r) |
|
923 | 946 |
self._print(r, print_dict) |
924 |
|
|
925 | 947 |
if self['wait']: |
926 | 948 |
self._wait(r['id'], 'PENDING') |
927 | 949 |
|
Also available in: Unified diff