You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2015/06/20 10:41:53 UTC

[2/4] libcloud git commit: Update is_valid_ip_address to throw when checking for IPv6 address on Windows.

Update is_valid_ip_address to throw when checking for IPv6 address on Windows.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/b276c2dc
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/b276c2dc
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/b276c2dc

Branch: refs/heads/trunk
Commit: b276c2dc735418145910b30eecfa3beac31a5fce
Parents: 918cb0f
Author: Tomaz Muraus <to...@tomaz.me>
Authored: Sat Jun 20 16:32:20 2015 +0800
Committer: Tomaz Muraus <to...@tomaz.me>
Committed: Sat Jun 20 16:32:20 2015 +0800

----------------------------------------------------------------------
 libcloud/utils/networking.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/b276c2dc/libcloud/utils/networking.py
----------------------------------------------------------------------
diff --git a/libcloud/utils/networking.py b/libcloud/utils/networking.py
index b49cc15..88c1cb4 100644
--- a/libcloud/utils/networking.py
+++ b/libcloud/utils/networking.py
@@ -75,8 +75,13 @@ def is_valid_ip_address(address, family=socket.AF_INET):
 
     :return: ``bool`` True if the provided address is valid.
     """
+    is_windows = platform.system() == 'Windows'
+
+    if is_windows and family == socket.AF_INET6:
+        raise ValueError('Checking IPv6 addresses are not supported on Windows')
+
     try:
-        if (platform.system() == 'Windows'):
+        if is_windows:
             socket.inet_aton(address)
         else:
             socket.inet_pton(family, address)