Revision e9c73313 kamaki/clients/cyclades/__init__.py

b/kamaki/clients/cyclades/__init__.py
295 295
        :returns: (str) the new mode if successful, (bool) False if timed out
296 296
        """
297 297
        status, progress = get_status(self, item_id)
298
        if status != current_status:
299
            return status
300
        old_wait = total_wait = 0
301 298

  
302 299
        if wait_cb:
303
            wait_gen = wait_cb(1 + max_wait // delay)
300
            wait_gen = wait_cb(max_wait // delay)
304 301
            wait_gen.next()
305 302

  
303
        if status != current_status:
304
            if wait_cb:
305
                try:
306
                    wait_gen.next()
307
                except Exception:
308
                    pass
309
            return status
310
        old_wait = total_wait = 0
311

  
306 312
        while status == current_status and total_wait <= max_wait:
307 313
            if wait_cb:
308 314
                try:
......
310 316
                        wait_gen.next()
311 317
                except Exception:
312 318
                    break
313
            else:
314
                stdout.write('.')
315
                stdout.flush()
316 319
            old_wait = total_wait
317
            total_wait = progress or (total_wait + 1)
320
            total_wait = progress or total_wait + 1
318 321
            sleep(delay)
319 322
            status, progress = get_status(self, item_id)
320 323

  

Also available in: Unified diff