1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Handle ValueError during json.loads of json data from build

This commit is contained in:
Matt Martz 2014-05-12 13:51:55 -05:00
parent d725636469
commit 92b77048dc

View file

@ -140,7 +140,10 @@ class DockerImageManager:
if not chunk:
continue
chunk_json = json.loads(chunk)
try:
chunk_json = json.loads(chunk)
except ValueError:
continue
if 'error' in chunk_json:
self.error_msg = chunk_json['error']
@ -153,6 +156,12 @@ class DockerImageManager:
if match:
image_id = match.group(1)
# Just in case we skipped evaluating the JSON returned from build
# during every iteration, add an error if the image_id was never
# populated
if not image_id:
self.error_msg = 'Unknown error encountered'
return image_id
def has_changed(self):