mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
allow multiline returns from docker for mac
Nothing actually specifies the number of lines the docker api returns, so we need to allow for more than one line to be returned which this specfic docker returner does
This commit is contained in:
parent
a7e09f9260
commit
74aee1e372
1 changed files with 14 additions and 1 deletions
|
@ -559,6 +559,17 @@ def __virtual__():
|
|||
return (False, 'Docker module could not get imported')
|
||||
|
||||
|
||||
class DockerJSONDecoder(json.JSONDecoder):
|
||||
def decode(self, s, _w=None):
|
||||
objs = []
|
||||
for line in s.splitlines():
|
||||
if not line:
|
||||
continue
|
||||
obj, _ = self.raw_decode(line)
|
||||
objs.append(obj)
|
||||
return objs
|
||||
|
||||
|
||||
def _get_docker_py_versioninfo():
|
||||
'''
|
||||
Returns the version_info tuple from docker-py
|
||||
|
@ -3459,7 +3470,9 @@ def build(path=None,
|
|||
.format(image)
|
||||
)
|
||||
|
||||
stream_data = [json.loads(x) for x in response]
|
||||
stream_data = []
|
||||
for line in response:
|
||||
stream_data.extend(json.loads(line, cls=DockerJSONDecoder))
|
||||
errors = []
|
||||
# Iterate through API response and collect information
|
||||
for item in stream_data:
|
||||
|
|
Loading…
Add table
Reference in a new issue