+ return status if status != current_status else False
+
+ def wait_server(
+ self, server_id,
+ current_status='BUILD',
+ delay=1, max_wait=100, wait_cb=None):
+ """Wait for server while its status is current_status
+
+ :param server_id: integer (str or int)
+
+ :param current_status: (str) BUILD|ACTIVE|STOPPED|DELETED|REBOOT
+
+ :param delay: time interval between retries
+
+ :param wait_cb: if set a progressbar is used to show progress
+
+ :returns: (str) the new mode if succesfull, (bool) False if timed out
+ """
+
+ def get_status(self, server_id):
+ r = self.get_server_details(server_id)
+ return r['status'], (r.get('progress', None) if (
+ current_status in ('BUILD', )) else None)
+
+ return self._wait(
+ server_id, current_status, get_status, delay, max_wait, wait_cb)
+
+ def wait_network(
+ self, net_id,
+ current_status='LALA', delay=1, max_wait=100, wait_cb=None):
+ """Wait for network while its status is current_status
+
+ :param net_id: integer (str or int)
+
+ :param current_status: (str) PENDING | ACTIVE | DELETED
+
+ :param delay: time interval between retries
+
+ :param wait_cb: if set a progressbar is used to show progress
+
+ :returns: (str) the new mode if succesfull, (bool) False if timed out
+ """
+
+ def get_status(self, net_id):
+ r = self.get_network_details(net_id)
+ return r['status'], None
+
+ return self._wait(
+ net_id, current_status, get_status, delay, max_wait, wait_cb)