summaryrefslogtreecommitdiff
path: root/docker/utils
diff options
context:
space:
mode:
authorLei Gong <xue177125184@gmail.com>2017-03-09 15:40:22 +0800
committerLei Gong <xue177125184@gmail.com>2017-03-09 16:28:34 +0800
commiteba20084f68fffda28dffad083371ce9c0a27890 (patch)
tree53cf3f6d9618560789e956635f9240262c6052fd /docker/utils
parentfa52824363f373e3cce646f6d060fae2d271a051 (diff)
downloaddocker-py-eba20084f68fffda28dffad083371ce9c0a27890.tar.gz
fix: Missing exception handling in split_port when no container port
"localhost:host_port:" case will raise TypeError exception directly Catch the "TypeError" and give proper error message * docker/utils/ports.py Signed-off-by: Lei Gong <xue177125184@gmail.com>
Diffstat (limited to 'docker/utils')
-rw-r--r--docker/utils/ports.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/docker/utils/ports.py b/docker/utils/ports.py
index 5bb7079..e2aeb8c 100644
--- a/docker/utils/ports.py
+++ b/docker/utils/ports.py
@@ -85,8 +85,13 @@ def split_port(port):
return internal_range, external_range
external_ip, external_port, internal_port = parts
+
+ if not internal_port:
+ _raise_invalid_port(port)
+
internal_range = to_port_range(internal_port)
external_range = to_port_range(external_port, len(internal_range) == 1)
+
if not external_range:
external_range = [None] * len(internal_range)