Repository: libcloud
Updated Branches:
  refs/heads/trunk fd89abb57 -> e105433e9


Add check windows os in is_valid_ip_address to run inet_aton

Closes #343
Closes #498

Signed-off-by: Tomaz Muraus <[email protected]>


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

Branch: refs/heads/trunk
Commit: 918cb0f765d03aefc2aee75039d074b387ab0184
Parents: fd89abb
Author: 503264 <[email protected]>
Authored: Wed Jul 30 12:13:15 2014 +0200
Committer: Tomaz Muraus <[email protected]>
Committed: Sat Jun 20 16:28:28 2015 +0800

----------------------------------------------------------------------
 libcloud/utils/networking.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/918cb0f7/libcloud/utils/networking.py
----------------------------------------------------------------------
diff --git a/libcloud/utils/networking.py b/libcloud/utils/networking.py
index d508d24..b49cc15 100644
--- a/libcloud/utils/networking.py
+++ b/libcloud/utils/networking.py
@@ -5,7 +5,7 @@
 # (the "License"); you may not use this file except in compliance with
 # the License.  You may obtain a copy of the License at
 #
-#     http://www.apache.org/licenses/LICENSE-2.0
+# http://www.apache.org/licenses/LICENSE-2.0
 #
 # Unless required by applicable law or agreed to in writing, software
 # distributed under the License is distributed on an "AS IS" BASIS,
@@ -15,6 +15,7 @@
 
 import socket
 import struct
+import platform
 
 __all__ = [
     'is_private_subnet',
@@ -75,7 +76,10 @@ def is_valid_ip_address(address, family=socket.AF_INET):
     :return: ``bool`` True if the provided address is valid.
     """
     try:
-        socket.inet_pton(family, address)
+        if (platform.system() == 'Windows'):
+            socket.inet_aton(address)
+        else:
+            socket.inet_pton(family, address)
     except socket.error:
         return False
 

Reply via email to