Fix Docker logs decoding. Ref #2522

This commit is contained in:
grossmj committed 2025-04-18 13:58:56 +07:00
1 parent ca34053125
commit ffd628902c
2 files changed
+5 -6

No files matched your search

+4 -5
View File
@@ -173,11 +173,10 @@ class Docker(BaseManager):
response = await self.http_query(method, path, data=data, params=params)
body = await response.read()
response.close()
if body and len(body):
if response.headers.get('CONTENT-TYPE') == 'application/json':
body = json.loads(body.decode("utf-8"))
else:
body = body.decode("utf-8")
if response.headers.get('CONTENT-TYPE') == 'application/json':
body = json.loads(body.decode("utf-8", errors="ignore"))
else:
body = body.decode("utf-8", errors="ignore")
log.debug("Query Docker %s %s params=%s data=%s Response: %s", method, path, params, data, body)
return body
+1 -1
View File
@@ -1203,7 +1203,7 @@ class DockerVM(BaseNode):
"""
result = await self.manager.query("GET", "containers/{}/logs".format(self._cid), params={"stderr": 1, "stdout": 1})
return result.decode('utf-8', errors='ignore').strip()
return result
async def delete(self):
"""