Revision d19b7ee3 kamaki/cli/commands/cyclades.py
b/kamaki/cli/commands/cyclades.py | ||
---|---|---|
877 | 877 |
net['user_id'] += ' (%s)' % usernames[user_id] |
878 | 878 |
if tenant_id: |
879 | 879 |
net['tenant_id'] += ' (%s)' % usernames[tenant_id] |
880 |
|
|
881 |
|
|
882 |
@command(network_cmds) |
|
883 |
class network_wait(_init_cyclades, _network_wait): |
|
884 |
"""Wait for server to finish [PENDING, ACTIVE, DELETED]""" |
|
885 |
|
|
886 |
arguments = dict( |
|
887 |
timeout=IntArgument( |
|
888 |
'Wait limit in seconds (default: 60)', '--timeout', default=60) |
|
889 |
) |
|
890 |
|
|
891 |
@errors.generic.all |
|
892 |
@errors.cyclades.connection |
|
893 |
@errors.cyclades.network_id |
|
894 |
def _run(self, network_id, current_status): |
|
895 |
net = self.client.get_network_details(network_id) |
|
896 |
if net['status'].lower() == current_status.lower(): |
|
897 |
self._wait(network_id, current_status, timeout=self['timeout']) |
|
898 |
else: |
|
899 |
self.error( |
|
900 |
'Network %s: Cannot wait for status %s, ' |
|
901 |
'status is already %s' % ( |
|
902 |
network_id, current_status, net['status'])) |
|
903 |
|
|
904 |
def main(self, network_id, current_status='PENDING'): |
|
905 |
super(self.__class__, self)._run() |
|
906 |
self._run(network_id=network_id, current_status=current_status) |
Also available in: Unified diff