Skip to content

Commit

Permalink
Fix handling of ProviderError during checkout
Browse files Browse the repository at this point in the history
  • Loading branch information
lpramuk authored and JacobCallahan committed Jan 20, 2023
1 parent 02320a3 commit 4da7d57
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions broker/broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ def _checkout(self):
host = self._act(provider, method, checkout=True)
except exceptions.ProviderError as err:
host = err
hosts.append(host)
if host and not isinstance(host, exceptions.ProviderError):
hosts.append(host)
logger.info(f"{host.__class__.__name__}: {host.hostname}")
return hosts

Expand All @@ -147,11 +147,9 @@ def checkout(self):
:return: Host obj or list of Host objects
"""
hosts = self._checkout()
err, to_emit = None, []
for host in hosts:
if not isinstance(host, exceptions.ProviderError):
to_emit.append(host.to_dict())
else:
err = None
for host in hosts[:]:
if isinstance(host, exceptions.ProviderError):
err = host
hosts.remove(host)
helpers.emit(hosts=[host.to_dict() for host in hosts])
Expand Down

0 comments on commit 4da7d57

Please sign in to comment.