mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Removes more netaddr deps (#44657)
Removed dependency from bigip_snat_pool
This commit is contained in:
parent
f3a61dd93d
commit
cd2a3eb1ea
1 changed files with 5 additions and 15 deletions
|
@ -41,9 +41,6 @@ options:
|
||||||
- Device partition to manage resources on.
|
- Device partition to manage resources on.
|
||||||
default: Common
|
default: Common
|
||||||
version_added: 2.5
|
version_added: 2.5
|
||||||
notes:
|
|
||||||
- Requires the netaddr Python package on the host. This is as easy as
|
|
||||||
pip install netaddr
|
|
||||||
extends_documentation_fragment: f5
|
extends_documentation_fragment: f5
|
||||||
author:
|
author:
|
||||||
- Tim Rupp (@caphrim007)
|
- Tim Rupp (@caphrim007)
|
||||||
|
@ -103,6 +100,7 @@ try:
|
||||||
from library.module_utils.network.f5.common import AnsibleF5Parameters
|
from library.module_utils.network.f5.common import AnsibleF5Parameters
|
||||||
from library.module_utils.network.f5.common import cleanup_tokens
|
from library.module_utils.network.f5.common import cleanup_tokens
|
||||||
from library.module_utils.network.f5.common import f5_argument_spec
|
from library.module_utils.network.f5.common import f5_argument_spec
|
||||||
|
from library.module_utils.network.f5.ipaddress import is_valid_ip
|
||||||
try:
|
try:
|
||||||
from library.module_utils.network.f5.common import iControlUnexpectedHTTPError
|
from library.module_utils.network.f5.common import iControlUnexpectedHTTPError
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
@ -114,17 +112,12 @@ except ImportError:
|
||||||
from ansible.module_utils.network.f5.common import AnsibleF5Parameters
|
from ansible.module_utils.network.f5.common import AnsibleF5Parameters
|
||||||
from ansible.module_utils.network.f5.common import cleanup_tokens
|
from ansible.module_utils.network.f5.common import cleanup_tokens
|
||||||
from ansible.module_utils.network.f5.common import f5_argument_spec
|
from ansible.module_utils.network.f5.common import f5_argument_spec
|
||||||
|
from ansible.module_utils.network.f5.ipaddress import is_valid_ip
|
||||||
try:
|
try:
|
||||||
from ansible.module_utils.network.f5.common import iControlUnexpectedHTTPError
|
from ansible.module_utils.network.f5.common import iControlUnexpectedHTTPError
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_F5SDK = False
|
HAS_F5SDK = False
|
||||||
|
|
||||||
try:
|
|
||||||
from netaddr import IPAddress, AddrFormatError
|
|
||||||
HAS_NETADDR = True
|
|
||||||
except ImportError:
|
|
||||||
HAS_NETADDR = False
|
|
||||||
|
|
||||||
|
|
||||||
class Parameters(AnsibleF5Parameters):
|
class Parameters(AnsibleF5Parameters):
|
||||||
api_map = {}
|
api_map = {}
|
||||||
|
@ -174,11 +167,10 @@ class Parameters(AnsibleF5Parameters):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def _format_member_address(self, member):
|
def _format_member_address(self, member):
|
||||||
try:
|
if is_valid_ip(member):
|
||||||
address = str(IPAddress(member))
|
address = '/{0}/{1}'.format(self.partition, member)
|
||||||
address = '/{0}/{1}'.format(self.partition, address)
|
|
||||||
return address
|
return address
|
||||||
except (AddrFormatError, ValueError):
|
else:
|
||||||
raise F5ModuleError(
|
raise F5ModuleError(
|
||||||
'The provided member address is not a valid IP address'
|
'The provided member address is not a valid IP address'
|
||||||
)
|
)
|
||||||
|
@ -401,8 +393,6 @@ def main():
|
||||||
)
|
)
|
||||||
if not HAS_F5SDK:
|
if not HAS_F5SDK:
|
||||||
module.fail_json(msg="The python f5-sdk module is required")
|
module.fail_json(msg="The python f5-sdk module is required")
|
||||||
if not HAS_NETADDR:
|
|
||||||
module.fail_json(msg="The python netaddr module is required")
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
client = F5Client(**module.params)
|
client = F5Client(**module.params)
|
||||||
|
|
Loading…
Reference in a new issue