Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Sep 1, 2021. It is now read-only.

Commit dd84c17

Browse files
authored
Workaround for docker-py bug with macOS (#162)
1 parent 4a7f301 commit dd84c17

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

alidock/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def isRunning(self):
8989
runStatus["image"] = runContainer.image.attrs["RepoTags"][0]
9090
except IndexError:
9191
runStatus["image"] = runContainer.image.attrs["Id"]
92-
except docker.errors.NotFound:
92+
except (docker.errors.NotFound, requests.exceptions.ChunkedEncodingError):
9393
pass
9494
return runStatus
9595

@@ -99,7 +99,7 @@ def getSshCommand(self):
9999
try:
100100
attrs = self.cli.containers.get(self.conf["dockName"]).attrs
101101
sshPort = attrs["NetworkSettings"]["Ports"]["22/tcp"][0]["HostPort"]
102-
except (docker.errors.NotFound, KeyError) as exc:
102+
except (docker.errors.NotFound, KeyError, requests.exceptions.ChunkedEncodingError) as exc:
103103
outLog = os.path.join(outPath, "log.txt")
104104
try:
105105
with open(outLog, "a+"):
@@ -152,7 +152,7 @@ def shell(self, cmd=None):
152152
try:
153153
attrs = self.cli.containers.get(self.conf["dockName"]).attrs
154154
xPort = attrs["NetworkSettings"]["Ports"]["14500/tcp"][0]["HostPort"]
155-
except (docker.errors.NotFound, KeyError):
155+
except (docker.errors.NotFound, KeyError, requests.exceptions.ChunkedEncodingError):
156156
xPort = None
157157
if not xPort and platform.system() == "Windows" and "DISPLAY" not in os.environ:
158158
# On Windows if no DISPLAY environment is set we assume a sensible default
@@ -304,7 +304,7 @@ def run(self):
304304
def stop(self):
305305
try:
306306
self.cli.containers.get(self.conf["dockName"]).remove(force=True)
307-
except docker.errors.NotFound:
307+
except (docker.errors.NotFound, requests.exceptions.ChunkedEncodingError):
308308
pass # final state is fine, container is gone
309309

310310
def pull(self):

0 commit comments

Comments
 (0)