Removes f5-sdk code from bigip modules (#44595)

This patch is part of an ongoing effort to fully remove the f5sdk
from the f5 modules.
This commit is contained in:
Tim Rupp 2018-08-23 16:53:34 -04:00 committed by GitHub
commit 9c12d845ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 149 additions and 203 deletions

View file

@ -69,8 +69,6 @@ options:
choices:
- absent
- present
requirements:
- netaddr
extends_documentation_fragment: f5
author:
- Tim Rupp (@caphrim007)
@ -115,6 +113,7 @@ try:
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 f5_argument_spec
from library.module_utils.network.f5.ipaddress import is_valid_ip
try:
from library.module_utils.network.f5.common import iControlUnexpectedHTTPError
except ImportError:
@ -126,17 +125,12 @@ except ImportError:
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 f5_argument_spec
from ansible.module_utils.network.f5.ipaddress import is_valid_ip
try:
from ansible.module_utils.network.f5.common import iControlUnexpectedHTTPError
except ImportError:
HAS_F5SDK = False
try:
import netaddr
HAS_NETADDR = True
except ImportError:
HAS_NETADDR = False
class Parameters(AnsibleF5Parameters):
api_map = {
@ -171,13 +165,11 @@ class Parameters(AnsibleF5Parameters):
def peer_server(self):
if self._values['peer_server'] is None:
return None
try:
result = str(netaddr.IPAddress(self._values['peer_server']))
return result
except netaddr.core.AddrFormatError:
raise F5ModuleError(
"The provided 'peer_server' parameter is not an IP address."
)
if is_valid_ip(self._values['peer_server']):
return self._values['peer_server']
raise F5ModuleError(
"The provided 'peer_server' parameter is not an IP address."
)
@property
def peer_hostname(self):
@ -334,8 +326,6 @@ def main():
)
if not HAS_F5SDK:
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:
client = F5Client(**module.params)