collection 교체

This commit is contained in:
정훈 변
2024-02-23 16:37:40 +09:00
parent b494779b5b
commit 3fd554eee9
38862 changed files with 220204 additions and 6600073 deletions

View File

@@ -8,12 +8,10 @@ Test plugin file for netaddr tests: in_any_network
"""
from __future__ import absolute_import, division, print_function
from ansible_collections.ansible.utils.plugins.test.in_network import (
_in_network,
)
from ansible_collections.ansible.utils.plugins.plugin_utils.base.utils import (
_validate_args,
)
from ansible_collections.ansible.utils.plugins.plugin_utils.base.utils import _validate_args
from ansible_collections.ansible.utils.plugins.test.in_network import _in_network
__metaclass__ = type
@@ -28,13 +26,13 @@ DOCUMENTATION = """
ip:
description:
- A string that represents an IP address of a host or network
- For example: "10.1.1.1"
- 'For example: C(10.1.1.1)'
type: str
required: True
networks:
description:
- A list of string and each string represents a network address in CIDR form
- For example: ['10.0.0.0/8', '192.168.1.0/24']
- "For example: C(['10.0.0.0/8', '192.168.1.0/24'])"
type: list
required: True
notes:
@@ -80,7 +78,6 @@ EXAMPLES = r"""
# },
# "changed": false
# }
"""
RETURN = """

View File

@@ -8,14 +8,14 @@ Test plugin file for netaddr tests: in_network
"""
from __future__ import absolute_import, division, print_function
from ansible_collections.ansible.utils.plugins.plugin_utils.base.ipaddress_utils import (
ip_network,
_is_subnet_of,
_need_ipaddress,
ip_network,
)
from ansible_collections.ansible.utils.plugins.plugin_utils.base.utils import (
_validate_args,
)
from ansible_collections.ansible.utils.plugins.plugin_utils.base.utils import _validate_args
__metaclass__ = type
@@ -30,13 +30,13 @@ DOCUMENTATION = """
ip:
description:
- A string that represents an IP address
- For example: "10.1.1.1"
- 'For example: C(10.1.1.1)'
type: str
required: True
network:
description:
- A string that represents the network address in CIDR form
- For example: "10.0.0.0/8"
- 'For example: C(10.0.0.0/8)'
type: str
required: True
notes:
@@ -95,7 +95,6 @@ EXAMPLES = r"""
# },
# "changed": false
# }
"""
RETURN = """

View File

@@ -8,12 +8,11 @@ Test plugin file for netaddr tests: in_one_network
"""
from __future__ import absolute_import, division, print_function
from ansible_collections.ansible.utils.plugins.test.in_network import (
_in_network,
)
from ansible_collections.ansible.utils.plugins.plugin_utils.base.ipaddress_utils import (
_validate_args,
)
from ansible_collections.ansible.utils.plugins.test.in_network import _in_network
__metaclass__ = type
@@ -29,13 +28,13 @@ DOCUMENTATION = """
ip:
description:
- A string that represents an IP address
- For example: "10.1.1.1"
- 'For example: C(10.1.1.1)'
type: str
required: True
networks:
description:
- A list of string and each string represents a network address in CIDR form
- For example: ['10.0.0.0/8', '192.168.1.0/24']
- "For example: C(['10.0.0.0/8', '192.168.1.0/24'])"
type: list
required: True
notes:
@@ -79,7 +78,6 @@ EXAMPLES = r"""
# },
# "changed": false
# }
"""
RETURN = """

View File

@@ -8,13 +8,13 @@ Test plugin file for netaddr tests: ip
"""
from __future__ import absolute_import, division, print_function
from ansible_collections.ansible.utils.plugins.plugin_utils.base.ipaddress_utils import (
ip_network,
_need_ipaddress,
ip_network,
)
from ansible_collections.ansible.utils.plugins.plugin_utils.base.utils import (
_validate_args,
)
from ansible_collections.ansible.utils.plugins.plugin_utils.base.utils import _validate_args
__metaclass__ = type
@@ -29,10 +29,7 @@ DOCUMENTATION = """
ip:
description:
- A string that represents the value against which the test is going to be performed
- For example:
- "10.1.1.1"
- "2001:db8:a::123"
- "hello-world"
- 'For example: C(10.1.1.1), C(2001:db8:a::123), or C("hello-world")'
type: str
required: True
notes:
@@ -101,7 +98,6 @@ EXAMPLES = r"""
# },
# "changed": false
# }
"""
RETURN = """

View File

@@ -8,13 +8,12 @@ Test plugin file for netaddr tests: ip_address
"""
from __future__ import absolute_import, division, print_function
from ansible_collections.ansible.utils.plugins.plugin_utils.base.ipaddress_utils import (
ip_address,
_need_ipaddress,
ip_address,
)
from ansible_collections.ansible.utils.plugins.plugin_utils.base.utils import (
_validate_args,
)
from ansible_collections.ansible.utils.plugins.plugin_utils.base.utils import _validate_args
__metaclass__ = type
@@ -30,9 +29,7 @@ DOCUMENTATION = """
ip:
description:
- A string that represents the value against which the test is going to be performed
- For example:
- "10.1.1.1"
- "hello-world"
- 'For example: C(10.1.1.1) or C("hello-world")'
type: str
required: True
notes:
@@ -77,7 +74,6 @@ EXAMPLES = r"""
# },
# "changed": false
# }
"""
RETURN = """

View File

@@ -8,12 +8,14 @@ Test plugin file for netaddr tests: ipv4
"""
from __future__ import absolute_import, division, print_function
from ansible_collections.ansible.utils.plugins.plugin_utils.base.ipaddress_utils import (
ip_network,
_need_ipaddress,
_validate_args,
ip_network,
)
__metaclass__ = type
DOCUMENTATION = """
@@ -27,10 +29,7 @@ DOCUMENTATION = """
ip:
description:
- A string that represents the value against which the test is going to be performed
- For example:
- "10.1.1.1"
- "10.0.0.0/8"
- "fe80::216:3eff:fee4:16f3"
- 'For example: C(10.1.1.1), C(10.0.0.0/8), or C(fe80::216:3eff:fee4:16f3)'
type: str
required: True
notes:
@@ -75,7 +74,6 @@ EXAMPLES = r"""
# },
# "changed": false
# }
"""
RETURN = """

View File

@@ -8,13 +8,13 @@ Test plugin file for netaddr tests: ipv4_address
"""
from __future__ import absolute_import, division, print_function
from ansible_collections.ansible.utils.plugins.plugin_utils.base.ipaddress_utils import (
ip_address,
_need_ipaddress,
ip_address,
)
from ansible_collections.ansible.utils.plugins.plugin_utils.base.utils import (
_validate_args,
)
from ansible_collections.ansible.utils.plugins.plugin_utils.base.utils import _validate_args
__metaclass__ = type
@@ -29,10 +29,7 @@ DOCUMENTATION = """
ip:
description:
- A string that represents the value against which the test is going to be performed
- For example:
- "10.1.1.1"
- "10.0.0.0/8"
- "fe80::216:3eff:fee4:16f3"
- 'For example: C(10.1.1.1), C(10.0.0.0/8), or C(fe80::216:3eff:fee4:16f3)'
type: str
required: True
notes:
@@ -77,7 +74,6 @@ EXAMPLES = r"""
# },
# "changed": false
# }
"""
RETURN = """

View File

@@ -8,13 +8,13 @@ Test plugin file for netaddr tests: ipv4_hostmask
"""
from __future__ import absolute_import, division, print_function
from ansible_collections.ansible.utils.plugins.plugin_utils.base.ipaddress_utils import (
ip_network,
_need_ipaddress,
ip_network,
)
from ansible_collections.ansible.utils.plugins.plugin_utils.base.utils import (
_validate_args,
)
from ansible_collections.ansible.utils.plugins.plugin_utils.base.utils import _validate_args
__metaclass__ = type
@@ -29,9 +29,7 @@ DOCUMENTATION = """
ip:
description:
- A string that represents the value against which the test is going to be performed
- For example:
- "0.1.255.255"
- "255.255.255.0"
- 'For example: C(0.1.255.255) or C(255.255.255.0)'
type: str
required: True
notes:
@@ -64,7 +62,6 @@ EXAMPLES = r"""
# },
# "changed": false
# }
"""
RETURN = """

View File

@@ -8,13 +8,13 @@ Test plugin file for netaddr tests: ipv4_netmask
"""
from __future__ import absolute_import, division, print_function
from ansible_collections.ansible.utils.plugins.plugin_utils.base.ipaddress_utils import (
ip_network,
_need_ipaddress,
ip_network,
)
from ansible_collections.ansible.utils.plugins.plugin_utils.base.utils import (
_validate_args,
)
from ansible_collections.ansible.utils.plugins.plugin_utils.base.utils import _validate_args
__metaclass__ = type
@@ -29,9 +29,7 @@ DOCUMENTATION = """
mask:
description:
- A string that represents the value against which the test is going to be performed
- For example:
- "0.1.255.255"
- "255.255.255.0"
- 'For example: C(0.1.255.255) or C(255.255.255.0)'
type: str
required: True
notes:
@@ -76,7 +74,6 @@ EXAMPLES = r"""
# },
# "changed": false
# }
"""
RETURN = """

View File

@@ -8,13 +8,13 @@ Test plugin file for netaddr tests: ipv6
"""
from __future__ import absolute_import, division, print_function
from ansible_collections.ansible.utils.plugins.plugin_utils.base.ipaddress_utils import (
ip_network,
_need_ipaddress,
ip_network,
)
from ansible_collections.ansible.utils.plugins.plugin_utils.base.utils import (
_validate_args,
)
from ansible_collections.ansible.utils.plugins.plugin_utils.base.utils import _validate_args
__metaclass__ = type
@@ -29,10 +29,7 @@ DOCUMENTATION = """
ip:
description:
- A string that represents the value against which the test is going to be performed
- For example:
- "10.1.1.1"
- "10.0.0.0/8"
- "fe80::216:3eff:fee4:16f3"
- 'For example: C(10.1.1.1), C(10.0.0.0/8), or C(fe80::216:3eff:fee4:16f3)'
type: str
required: True
notes:
@@ -77,7 +74,6 @@ EXAMPLES = r"""
# },
# "changed": false
# }
"""
RETURN = """

View File

@@ -8,13 +8,13 @@ Test plugin file for netaddr tests: ipv6_address
"""
from __future__ import absolute_import, division, print_function
from ansible_collections.ansible.utils.plugins.plugin_utils.base.ipaddress_utils import (
ip_address,
_need_ipaddress,
ip_address,
)
from ansible_collections.ansible.utils.plugins.plugin_utils.base.utils import (
_validate_args,
)
from ansible_collections.ansible.utils.plugins.plugin_utils.base.utils import _validate_args
__metaclass__ = type
@@ -29,10 +29,7 @@ DOCUMENTATION = """
ip:
description:
- A string that represents the value against which the test is going to be performed
- For example:
- "10.1.1.1"
- "10.0.0.0/8"
- "fe80::216:3eff:fee4:16f3"
- 'For example: C(10.1.1.1), C(10.0.0.0/8), or C(fe80::216:3eff:fee4:16f3)'
type: str
required: True
notes:
@@ -77,7 +74,6 @@ EXAMPLES = r"""
# },
# "changed": false
# }
"""
RETURN = """

View File

@@ -8,12 +8,14 @@ Test plugin file for netaddr tests: ipv6_ipv4_mapped
"""
from __future__ import absolute_import, division, print_function
from ansible_collections.ansible.utils.plugins.plugin_utils.base.ipaddress_utils import (
ip_address,
_need_ipaddress,
_validate_args,
ip_address,
)
__metaclass__ = type
DOCUMENTATION = """
@@ -27,10 +29,7 @@ DOCUMENTATION = """
ip:
description:
- A string that represents the value against which the test is going to be performed
- For example:
- "::FFFF:10.1.1.1"
- "::AAAA:10.1.1.1"
- "helloworld"
- 'For example: C(::FFFF:10.1.1.1), C(::AAAA:10.1.1.1), or C("helloworld")'
type: str
required: True
notes:
@@ -75,7 +74,6 @@ EXAMPLES = r"""
# },
# "changed": false
# }
"""
RETURN = """

View File

@@ -8,13 +8,13 @@ Test plugin file for netaddr tests: ipv6_sixtofour
"""
from __future__ import absolute_import, division, print_function
from ansible_collections.ansible.utils.plugins.plugin_utils.base.ipaddress_utils import (
ip_address,
_need_ipaddress,
ip_address,
)
from ansible_collections.ansible.utils.plugins.plugin_utils.base.utils import (
_validate_args,
)
from ansible_collections.ansible.utils.plugins.plugin_utils.base.utils import _validate_args
__metaclass__ = type
@@ -29,10 +29,7 @@ DOCUMENTATION = """
ip:
description:
- A string that represents the value against which the test is going to be performed
- For example:
- "2002:c0a8:6301:1::1"
- "::AAAA:10.1.1.1"
- "hello_world"
- 'For example: C(2002:c0a8:6301:1::1), C(::AAAA:10.1.1.1), or C("hello_world")'
type: str
required: True
notes:
@@ -77,7 +74,6 @@ EXAMPLES = r"""
# },
# "changed": false
# }
"""
RETURN = """

View File

@@ -8,13 +8,13 @@ Test plugin file for netaddr tests: ipv6_teredo
"""
from __future__ import absolute_import, division, print_function
from ansible_collections.ansible.utils.plugins.plugin_utils.base.ipaddress_utils import (
ip_address,
_need_ipaddress,
ip_address,
)
from ansible_collections.ansible.utils.plugins.plugin_utils.base.utils import (
_validate_args,
)
from ansible_collections.ansible.utils.plugins.plugin_utils.base.utils import _validate_args
__metaclass__ = type
@@ -29,10 +29,7 @@ DOCUMENTATION = """
ip:
description:
- A string that represents the value against which the test is going to be performed
- For example:
- "2001::c0a8:6301:1"
- "2002::c0a8:6301:1"
- "hello_world"
- 'For example: C(2001::c0a8:6301:1), C(2002::c0a8:6301:1), or C("hello_world")'
type: str
required: True
notes:
@@ -77,7 +74,6 @@ EXAMPLES = r"""
# },
# "changed": false
# }
"""
RETURN = """

View File

@@ -8,12 +8,14 @@ Test plugin file for netaddr tests: loopback
"""
from __future__ import absolute_import, division, print_function
from ansible_collections.ansible.utils.plugins.plugin_utils.base.ipaddress_utils import (
ip_address,
_need_ipaddress,
_validate_args,
ip_address,
)
__metaclass__ = type
DOCUMENTATION = """
@@ -27,9 +29,7 @@ DOCUMENTATION = """
ip:
description:
- A string that represents the value against which the test is going to be performed
- For example:
- "127.0.0.1"
- "2002::c0a8:6301:1"
- 'For example: C(127.0.0.1) or C(2002::c0a8:6301:1)'
type: str
required: True
notes:
@@ -72,7 +72,6 @@ EXAMPLES = r"""
# },
# "changed": false
# }
"""
RETURN = """

View File

@@ -8,11 +8,12 @@ Test plugin file for netaddr tests: mac
"""
from __future__ import absolute_import, division, print_function
from ansible_collections.ansible.utils.plugins.plugin_utils.base.utils import (
_validate_args,
)
import re
from ansible_collections.ansible.utils.plugins.plugin_utils.base.utils import _validate_args
__metaclass__ = type
DOCUMENTATION = """
@@ -26,11 +27,7 @@ DOCUMENTATION = """
mac:
description:
- A string that represents the value against which the test is going to be performed
- For example:
- "02:16:3e:e4:16:f3"
- "02-16-3e-e4-16-f3"
- "0216.3ee4.16f3"
- "02163ee416f3"
- 'For example: C(02:16:3e:e4:16:f3), C(02-16-3e-e4-16-f3), C(0216.3ee4.16f3), or C(02163ee416f3)'
type: str
required: True
notes:
@@ -97,7 +94,6 @@ EXAMPLES = r"""
# },
# "changed": false
# }
"""
RETURN = """
@@ -115,12 +111,12 @@ def _mac(mac):
_validate_args("mac", DOCUMENTATION, params)
# IEEE EUI-48 upper and lower, commom unix
re1 = r"^(?i)([0-9a-f]{2}[:-]){5}[0-9a-f]{2}$"
re1 = r"^([0-9a-f]{2}[:-]){5}[0-9a-f]{2}$"
# Cisco triple hextex
re2 = r"^(?i)([0-9a-f]{4}\.[0-9a-f]{4}\.[0-9a-f]{4})$"
re2 = r"^([0-9a-f]{4}\.[0-9a-f]{4}\.[0-9a-f]{4})$"
# Bare
re3 = r"^(?i)[0-9a-f]{12}$"
regex = "{re1}|{re2}|{re3}".format(re1=re1, re2=re2, re3=re3)
re3 = r"^[0-9a-f]{12}$"
regex = "(?i){re1}|{re2}|{re3}".format(re1=re1, re2=re2, re3=re3)
return bool(re.match(regex, mac))

View File

@@ -8,13 +8,12 @@ Test plugin file for netaddr tests: multicast
"""
from __future__ import absolute_import, division, print_function
from ansible_collections.ansible.utils.plugins.plugin_utils.base.ipaddress_utils import (
ip_address,
_need_ipaddress,
ip_address,
)
from ansible_collections.ansible.utils.plugins.plugin_utils.base.utils import (
_validate_args,
)
from ansible_collections.ansible.utils.plugins.plugin_utils.base.utils import _validate_args
__metaclass__ = type
@@ -30,9 +29,7 @@ DOCUMENTATION = """
ip:
description:
- A string that represents the value against which the test is going to be performed
- For example:
- "224.0.0.1"
- "127.0.0.1"
- 'For example: C(224.0.0.1) or C(127.0.0.1)'
type: str
required: True
notes:
@@ -87,7 +84,6 @@ EXAMPLES = r"""
# },
# "changed": false
# }
"""
RETURN = """

View File

@@ -8,13 +8,13 @@ Test plugin file for netaddr tests: private
"""
from __future__ import absolute_import, division, print_function
from ansible_collections.ansible.utils.plugins.plugin_utils.base.ipaddress_utils import (
ip_address,
_need_ipaddress,
ip_address,
)
from ansible_collections.ansible.utils.plugins.plugin_utils.base.utils import (
_validate_args,
)
from ansible_collections.ansible.utils.plugins.plugin_utils.base.utils import _validate_args
__metaclass__ = type
@@ -29,10 +29,7 @@ DOCUMENTATION = """
ip:
description:
- A string that represents the value against which the test is going to be performed
- For example:
- "10.1.1.1"
- "8.8.8.8"
- "192.168.1.250"
- 'For example: C(10.1.1.1), C(8.8.8.8), or C(192.168.1.250)'
type: str
required: True
notes:
@@ -63,7 +60,6 @@ EXAMPLES = r"""
# },
# "changed": false
# }
"""
RETURN = """

View File

@@ -8,12 +8,14 @@ Test plugin file for netaddr tests: public
"""
from __future__ import absolute_import, division, print_function
from ansible_collections.ansible.utils.plugins.plugin_utils.base.ipaddress_utils import (
ip_address,
_need_ipaddress,
_validate_args,
ip_address,
)
__metaclass__ = type
DOCUMENTATION = """
@@ -27,10 +29,7 @@ DOCUMENTATION = """
ip:
description:
- A string that represents the value against which the test is going to be performed
- For example:
- "8.8.8.8"
- "10.1.1.1"
- "192.168.1.250"
- 'For example: C(8.8.8.8), C(10.1.1.1), or C(192.168.1.250)'
type: str
required: True
notes:
@@ -61,7 +60,6 @@ EXAMPLES = r"""
# },
# "changed": false
# }
"""
RETURN = """

View File

@@ -8,13 +8,13 @@ Test plugin file for netaddr tests: reserved
"""
from __future__ import absolute_import, division, print_function
from ansible_collections.ansible.utils.plugins.plugin_utils.base.ipaddress_utils import (
ip_address,
_need_ipaddress,
ip_address,
)
from ansible_collections.ansible.utils.plugins.plugin_utils.base.utils import (
_validate_args,
)
from ansible_collections.ansible.utils.plugins.plugin_utils.base.utils import _validate_args
__metaclass__ = type
@@ -29,9 +29,7 @@ DOCUMENTATION = """
ip:
description:
- A string that represents the value against which the test is going to be performed
- For example:
- "253.0.0.1"
- "128.146.1.7"
- 'For example: C(253.0.0.1) or C(128.146.1.7)'
type: str
required: True
notes:
@@ -62,7 +60,6 @@ EXAMPLES = r"""
# },
# "changed": false
# }
"""
RETURN = """

View File

@@ -7,14 +7,14 @@
Test plugin file for netaddr tests: resolvable
"""
from __future__ import absolute_import, division, print_function
import socket
from ansible_collections.ansible.utils.plugins.plugin_utils.base.ipaddress_utils import (
_need_ipaddress,
)
from ansible_collections.ansible.utils.plugins.plugin_utils.base.utils import (
_validate_args,
)
from ansible_collections.ansible.utils.plugins.plugin_utils.base.utils import _validate_args
import socket
try:
import ipaddress
@@ -36,10 +36,7 @@ DOCUMENTATION = """
host:
description:
- A string that represents the IP address or the host name
- For example:
- "docs.ansible.com"
- 127.0.0.1
- ::1
- 'For example: C("docs.ansible.com"), C(127.0.0.1), or C(::1)'
type: str
required: True
notes:
@@ -110,7 +107,6 @@ EXAMPLES = r"""
# "changed": false,
# "msg": "All assertions passed"
# }
"""
RETURN = """

View File

@@ -8,13 +8,15 @@ Test plugin file for netaddr tests: subnet_of
"""
from __future__ import absolute_import, division, print_function
from ansible_collections.ansible.utils.plugins.plugin_utils.base.ipaddress_utils import (
ip_network,
_need_ipaddress,
_is_subnet_of,
_need_ipaddress,
_validate_args,
ip_network,
)
__metaclass__ = type
DOCUMENTATION = """
@@ -28,15 +30,13 @@ DOCUMENTATION = """
network_a:
description:
- A string that represents the first network address
- For example:
- "10.1.1.0/24"
- 'For example: C(10.1.1.0/24)'
type: str
required: True
network_b:
description:
- A string that represents the second network address
- For example:
- "10.0.0.0/8"
- 'For example: C(10.0.0.0/8)'
type: str
required: True
notes:
@@ -67,7 +67,6 @@ EXAMPLES = r"""
# },
# "changed": false
# }
"""
RETURN = """

View File

@@ -8,14 +8,14 @@ Test plugin file for netaddr tests: supernet_of
"""
from __future__ import absolute_import, division, print_function
from ansible_collections.ansible.utils.plugins.plugin_utils.base.ipaddress_utils import (
ip_network,
_need_ipaddress,
_is_subnet_of,
_need_ipaddress,
ip_network,
)
from ansible_collections.ansible.utils.plugins.plugin_utils.base.utils import (
_validate_args,
)
from ansible_collections.ansible.utils.plugins.plugin_utils.base.utils import _validate_args
__metaclass__ = type
@@ -30,15 +30,13 @@ DOCUMENTATION = """
network_a:
description:
- A string that represents the first network address
- For example:
- "10.1.1.0/24"
- 'For example: C(10.1.1.0/24)'
type: str
required: True
network_b:
description:
- A string that represents the second network address
- For example:
- "10.0.0.0/8"
- 'For example: C(10.0.0.0/8)'
type: str
required: True
notes:
@@ -69,7 +67,6 @@ EXAMPLES = r"""
# },
# "changed": false
# }
"""
RETURN = """

View File

@@ -8,12 +8,14 @@ Test plugin file for netaddr tests: unspecified
"""
from __future__ import absolute_import, division, print_function
from ansible_collections.ansible.utils.plugins.plugin_utils.base.ipaddress_utils import (
ip_address,
_need_ipaddress,
_validate_args,
ip_address,
)
__metaclass__ = type
DOCUMENTATION = """
@@ -27,11 +29,7 @@ DOCUMENTATION = """
ip:
description:
- A string that represents the value against which the test is going to be performed
- For example:
- "0.0.0.0"
- "0:0:0:0:0:0:0:0"
- "::"
- "::1"
- 'For example: C(0.0.0.0), C(0:0:0:0:0:0:0:0), C(::), or C(::1)'
type: str
required: True
notes:
@@ -88,7 +86,6 @@ EXAMPLES = r"""
# },
# "changed": false
# }
"""
RETURN = """

View File

@@ -5,6 +5,7 @@
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = """
name: validate
@@ -74,15 +75,13 @@ RETURN = """
from ansible.errors import AnsibleError
from ansible.module_utils._text import to_text
from ansible_collections.ansible.utils.plugins.plugin_utils.base.validate import (
_load_validator,
)
from ansible_collections.ansible.utils.plugins.module_utils.common.utils import (
to_list,
)
from ansible_collections.ansible.utils.plugins.module_utils.common.argspec_validate import (
check_argspec,
)
from ansible_collections.ansible.utils.plugins.module_utils.common.utils import to_list
from ansible_collections.ansible.utils.plugins.plugin_utils.base.validate import _load_validator
ARGSPEC_CONDITIONALS = {}
@@ -91,7 +90,7 @@ def validate(*args, **kwargs):
if not len(args):
raise AnsibleError(
"Missing either 'data' value in test plugin input,"
"refer ansible.utils.validate test plugin documentation for details"
"refer ansible.utils.validate test plugin documentation for details",
)
params = {"data": args[0]}
@@ -104,14 +103,14 @@ def validate(*args, **kwargs):
DOCUMENTATION,
"validate test",
schema_conditionals=ARGSPEC_CONDITIONALS,
**params
**params,
)
if not valid:
raise AnsibleError(
"{argspec_result} with errors: {argspec_errors}".format(
argspec_result=argspec_result.get("msg"),
argspec_errors=argspec_result.get("errors"),
)
),
)
validator_engine, validator_result = _load_validator(
@@ -122,8 +121,7 @@ def validate(*args, **kwargs):
)
if validator_result.get("failed"):
raise AnsibleError(
"validate lookup plugin failed with errors: %s"
% validator_result.get("msg")
"validate lookup plugin failed with errors: %s" % validator_result.get("msg"),
)
try:
@@ -135,7 +133,7 @@ def validate(*args, **kwargs):
"Unhandled exception from validator '{validator}'. Error: {err}".format(
validator=updated_params["engine"],
err=to_text(exc, errors="surrogate_then_replace"),
)
),
)
errors = to_list(result.get("errors", []))