File tree Expand file tree Collapse file tree 4 files changed +5
-10
lines changed Expand file tree Collapse file tree 4 files changed +5
-10
lines changed Original file line number Diff line number Diff line change 46
46
# L(specifiers,https://python-semanticversion.readthedocs.io/en/latest/#requirement-specification). Multiple version
47
47
# range specifiers can be set and are separated by ','
48
48
dependencies :
49
- # Required for ipaddress python library
50
- ansible.netcommon : " >=1.0.0"
51
-
52
49
# Required for json_query used in lookup plugin integration tests
53
50
community.general : " >=1.0.0"
54
51
Original file line number Diff line number Diff line change 248
248
from typing import Iterable
249
249
from itertools import chain
250
250
from collections import defaultdict
251
+ from ipaddress import ip_interface
251
252
252
253
from ansible .plugins .inventory import BaseInventoryPlugin , Constructable , Cacheable
253
254
from ansible .module_utils .ansible_release import __version__ as ansible_version
256
257
from ansible .module_utils .urls import open_url
257
258
from ansible .module_utils .six .moves .urllib import error as urllib_error
258
259
from ansible .module_utils .six .moves .urllib .parse import urlencode
259
- from ansible_collections .ansible .netcommon .plugins .module_utils .compat .ipaddress import (
260
- ip_interface ,
261
- )
262
260
263
261
264
262
class InventoryModule (BaseInventoryPlugin , Constructable , Cacheable ):
Original file line number Diff line number Diff line change 7
7
8
8
# Import necessary packages
9
9
import traceback
10
- from ansible_collections . ansible . netcommon . plugins . module_utils . compat import ipaddress
10
+ from ipaddress import ip_interface
11
11
from ansible .module_utils ._text import to_text
12
12
from ansible .module_utils .basic import missing_required_lib
13
13
@@ -169,7 +169,9 @@ def run(self):
169
169
if self .endpoint == "ip_addresses" :
170
170
if data .get ("address" ):
171
171
try :
172
- data ["address" ] = to_text (ipaddress .ip_network (data ["address" ]))
172
+ data ["address" ] = to_text (
173
+ ip_interface (data ["address" ]).with_prefixlen
174
+ )
173
175
except ValueError :
174
176
pass
175
177
name = data .get ("address" )
Original file line number Diff line number Diff line change 15
15
16
16
from itertools import chain
17
17
18
- from ansible_collections .ansible .netcommon .plugins .module_utils .compat import ipaddress
19
-
20
18
from ansible .module_utils .common .text .converters import to_text
21
19
22
20
from ansible .module_utils ._text import to_native
You can’t perform that action at this time.
0 commit comments