Skip to content

Commit 4da7d57

Browse files
lpramukJacobCallahan
authored andcommitted
Fix handling of ProviderError during checkout
1 parent 02320a3 commit 4da7d57

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

broker/broker.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ def _checkout(self):
136136
host = self._act(provider, method, checkout=True)
137137
except exceptions.ProviderError as err:
138138
host = err
139+
hosts.append(host)
139140
if host and not isinstance(host, exceptions.ProviderError):
140-
hosts.append(host)
141141
logger.info(f"{host.__class__.__name__}: {host.hostname}")
142142
return hosts
143143

@@ -147,11 +147,9 @@ def checkout(self):
147147
:return: Host obj or list of Host objects
148148
"""
149149
hosts = self._checkout()
150-
err, to_emit = None, []
151-
for host in hosts:
152-
if not isinstance(host, exceptions.ProviderError):
153-
to_emit.append(host.to_dict())
154-
else:
150+
err = None
151+
for host in hosts[:]:
152+
if isinstance(host, exceptions.ProviderError):
155153
err = host
156154
hosts.remove(host)
157155
helpers.emit(hosts=[host.to_dict() for host in hosts])

0 commit comments

Comments
 (0)