From 68a65b7bc73056364673dac63c90dfd8b377f5b5 Mon Sep 17 00:00:00 2001 From: PCoder Date: Sat, 30 Jun 2018 00:30:51 +0200 Subject: [PATCH] Detect private IP correctly --- opennebula_api/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/opennebula_api/models.py b/opennebula_api/models.py index 5416b6f2..c06d790e 100644 --- a/opennebula_api/models.py +++ b/opennebula_api/models.py @@ -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