summaryrefslogtreecommitdiff
path: root/plugins/module_utils
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/module_utils')
-rw-r--r--plugins/module_utils/network/vyos/utils/utils.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/plugins/module_utils/network/vyos/utils/utils.py b/plugins/module_utils/network/vyos/utils/utils.py
index 7ce4688..f6ac9f5 100644
--- a/plugins/module_utils/network/vyos/utils/utils.py
+++ b/plugins/module_utils/network/vyos/utils/utils.py
@@ -8,9 +8,14 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible.module_utils.six import iteritems
-from ansible_collections.ansible.netcommon.plugins.module_utils.compat import (
- ipaddress,
-)
+from ansible.module_utils.basic import missing_required_lib
+
+try:
+ import ipaddress
+
+ HAS_IPADDRESS = True
+except ImportError:
+ HAS_IPADDRESS = False
def search_obj_in_list(name, lst, key="name"):
@@ -212,6 +217,9 @@ def get_ip_address_version(address):
:param address: IP address
:return:
"""
+ if not HAS_IPADDRESS:
+ raise Exception(missing_required_lib("ipaddress"))
+
try:
address = unicode(address)
except NameError: