Try ipaddr filter from collection
Going forward, many of the filters and code that used to be in ansible core were moved to collections. We use the ipaddr filter in a few places so in order to support newer versions, we need to try to load the collection version first before falling back to the legacy one in ansible <=2.9 Change-Id: If1d273da61041fa4b7b9f4430264acda1d3841e8
This commit is contained in:
parent
0f6aae588c
commit
5eff049403
|
@ -46,7 +46,10 @@ import traceback
|
|||
|
||||
from ansible.errors import AnsibleError
|
||||
from ansible.plugins.action import ActionBase
|
||||
from ansible.plugins.filter import ipaddr
|
||||
try:
|
||||
from ansible_collections.ansible.netcommon.plugins.filter import ipaddr
|
||||
except ImportError:
|
||||
from ansible.plugins.filter import ipaddr
|
||||
from ansible.utils.display import Display
|
||||
|
||||
|
||||
|
|
|
@ -50,7 +50,10 @@ EXAMPLES = """
|
|||
|
||||
|
||||
from ansible.plugins.action import ActionBase
|
||||
from ansible.plugins.filter import ipaddr
|
||||
try:
|
||||
from ansible_collections.ansible.netcommon.plugins.filter import ipaddr
|
||||
except ImportError:
|
||||
from ansible.plugins.filter import ipaddr
|
||||
from ansible.utils.display import Display
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue