File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -166,19 +166,18 @@ def build(self, **kwargs):
166
166
resp = self .client .api .build (** kwargs )
167
167
if isinstance (resp , six .string_types ):
168
168
return self .get (resp )
169
- events = list ( json_stream (resp ))
170
- if not events :
171
- return BuildError ('Unknown' )
172
- for event in events :
173
- if 'stream' in event :
169
+ for chunk in json_stream (resp ):
170
+ if 'error' in chunk :
171
+ raise BuildError (chunk [ 'error' ] )
172
+ break
173
+ if 'stream' in chunk :
174
174
match = re .search (r'(Successfully built |sha256:)([0-9a-f]+)' ,
175
- event . get ( 'stream' , '' ) )
175
+ chunk [ 'stream' ] )
176
176
if match :
177
177
image_id = match .group (2 )
178
178
return self .get (image_id )
179
179
180
- event = events [- 1 ]
181
- raise BuildError (event .get ('error' ) or event )
180
+ return BuildError ('Unknown' )
182
181
183
182
def get (self , name ):
184
183
"""
You can’t perform that action at this time.
0 commit comments