@@ -2623,7 +2623,7 @@ async def wait_for_idle(self, apps=None, raise_on_error=True, raise_on_blocked=F
26232623 warnings .warn ("wait_for_active is deprecated; use status" , DeprecationWarning )
26242624 status = "active"
26252625
2626- _wait_for_units = wait_for_at_least_units or 1
2626+ _wait_for_units = wait_for_at_least_units if wait_for_at_least_units is not None else 1
26272627
26282628 timeout = timedelta (seconds = timeout ) if timeout is not None else None
26292629 idle_period = timedelta (seconds = idle_period )
@@ -2657,7 +2657,7 @@ def _raise_for_status(entities, status):
26572657 ", " .join (errored ),
26582658 ))
26592659
2660- if wait_for_exact_units :
2660+ if wait_for_exact_units is not None :
26612661 assert type (wait_for_exact_units ) == int and wait_for_exact_units >= 0 , \
26622662 'Invalid value for wait_for_exact_units : %s' % wait_for_exact_units
26632663
@@ -2680,7 +2680,7 @@ def _raise_for_status(entities, status):
26802680 blocks .setdefault ("App" , []).append (app .name )
26812681
26822682 # Check if wait_for_exact_units flag is used
2683- if wait_for_exact_units :
2683+ if wait_for_exact_units is not None :
26842684 if len (app .units ) != wait_for_exact_units :
26852685 busy .append (app .name + " (waiting for exactly %s units, current : %s)" %
26862686 (wait_for_exact_units , len (app .units )))
@@ -2697,7 +2697,7 @@ def _raise_for_status(entities, status):
26972697 # errors to raise at the end
26982698 break
26992699 for unit in app .units :
2700- if unit .machine and unit .machine .status == "error" :
2700+ if unit .machine is not None and unit .machine .status == "error" :
27012701 errors .setdefault ("Machine" , []).append (unit .machine .id )
27022702 continue
27032703 if unit .agent_status == "error" :
0 commit comments