Detect private IP correctly

This commit is contained in:
PCoder 2018-06-30 00:30:51 +02:00
parent a3db7f2e1a
commit 68a65b7bc7

View file

@ -1,3 +1,4 @@
import ipaddress
import logging
import socket
@ -225,7 +226,7 @@ class OpenNebulaManager():
:param ipv4:
:return: Returns true if it is a public IP else returns false
"""
if ipv4.startswith("10."):
if ipaddress.ip_address(ipv4).is_private:
return False
else:
return True