Revision 7b2e4bf1 kamaki/cli/commands/cyclades.py
b/kamaki/cli/commands/cyclades.py | ||
---|---|---|
87 | 87 |
currect_status, |
88 | 88 |
wait_cb=wait_cb) |
89 | 89 |
except Exception: |
90 |
self._safe_progress_bar_finish(progress_bar) |
|
91 | 90 |
raise |
92 | 91 |
finally: |
93 | 92 |
self._safe_progress_bar_finish(progress_bar) |
... | ... | |
97 | 96 |
raiseCLIError(None, 'Time out') |
98 | 97 |
|
99 | 98 |
|
99 |
class _network_wait(object): |
|
100 |
|
|
101 |
wait_arguments = dict( |
|
102 |
progress_bar=ProgressBarArgument( |
|
103 |
'do not show progress bar', |
|
104 |
('-N', '--no-progress-bar'), |
|
105 |
False |
|
106 |
) |
|
107 |
) |
|
108 |
|
|
109 |
def _wait(self, net_id, currect_status): |
|
110 |
(progress_bar, wait_cb) = self._safe_progress_bar( |
|
111 |
'Network %s still in %s mode' % (net_id, currect_status)) |
|
112 |
|
|
113 |
try: |
|
114 |
new_mode = self.client.wait_network( |
|
115 |
net_id, |
|
116 |
currect_status, |
|
117 |
wait_cb=wait_cb) |
|
118 |
except Exception: |
|
119 |
raise |
|
120 |
finally: |
|
121 |
self._safe_progress_bar_finish(progress_bar) |
|
122 |
if new_mode: |
|
123 |
print('Network %s is now in %s mode' % (net_id, new_mode)) |
|
124 |
else: |
|
125 |
raiseCLIError(None, 'Time out') |
|
126 |
|
|
127 |
|
|
100 | 128 |
class _init_cyclades(_command_init): |
101 | 129 |
@errors.generic.all |
102 | 130 |
@addLogSettings |
... | ... | |
778 | 806 |
self._run(nic_id=nic_id, server_id=server_id) |
779 | 807 |
|
780 | 808 |
|
809 |
@command(network_cmds) |
|
810 |
class network_wait(_init_cyclades, _network_wait): |
|
811 |
"""Wait for server to finish [PENDING, ACTIVE, DELETED]""" |
|
812 |
|
|
813 |
@errors.generic.all |
|
814 |
@errors.cyclades.connection |
|
815 |
@errors.cyclades.network_id |
|
816 |
def _run(self, network_id, currect_status): |
|
817 |
self._wait(network_id, currect_status) |
|
818 |
|
|
819 |
def main(self, network_id, currect_status='PENDING'): |
|
820 |
super(self.__class__, self)._run() |
|
821 |
self._run(network_id=network_id, currect_status=currect_status) |
|
822 |
|
|
823 |
|
|
781 | 824 |
@command(floatingip_cmds) |
782 | 825 |
class floatingip_pools(_init_cyclades, _optional_json): |
783 | 826 |
"""List all floating pools of floating ips""" |
Also available in: Unified diff