Detect private IP correctly
This commit is contained in:
parent
a3db7f2e1a
commit
68a65b7bc7
1 changed files with 2 additions and 1 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
import ipaddress
|
||||||
import logging
|
import logging
|
||||||
import socket
|
import socket
|
||||||
|
|
||||||
|
@ -225,7 +226,7 @@ class OpenNebulaManager():
|
||||||
:param ipv4:
|
:param ipv4:
|
||||||
:return: Returns true if it is a public IP else returns false
|
: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
|
return False
|
||||||
else:
|
else:
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in a new issue