Add parameter and remove netaddr (#44584)

This patch adds a description parameter to most fields. It also removes
netaddr from the modules.
pull/44594/head
Tim Rupp 6 years ago committed by GitHub
parent 31a5b874a1
commit 1fd6821db0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -24,12 +24,16 @@ options:
description:
- Specifies the name of the monitor.
required: True
description:
description:
- The description of the monitor.
version_added: 2.7
parent:
description:
- The parent template of this monitor template. Once this value has
been set, it cannot be changed. By default, this value is the C(http)
parent on the C(Common) partition.
default: "/Common/external"
default: /Common/external
arguments:
description:
- Specifies any command-line arguments that the script requires.
@ -59,12 +63,14 @@ options:
timeout:
description:
- The number of seconds in which the node or service must respond to
the monitor request. If the target responds within the set time
period, it is considered up. If the target does not respond within
the set time period, it is considered down. You can change this
number to any number you want, however, it should be 3 times the
interval number of seconds plus 1 second. If this parameter is not
provided when creating a new monitor, then the default value will be 16.
the monitor request.
- If the target responds within the set time period, it is considered up.
- If the target does not respond within the set time period, it is considered
down.
- You can change this number to any number you want, however, it should be
3 times the interval number of seconds plus 1 second.
- If this parameter is not provided when creating a new monitor, then the
default value will be C(16).
variables:
description:
- Specifies any variables that the script requires.
@ -84,6 +90,7 @@ options:
extends_documentation_fragment: f5
author:
- Tim Rupp (@caphrim007)
- Wojciech Wypior (@wojtek0806)
'''
EXAMPLES = r'''
@ -130,6 +137,11 @@ parent:
returned: changed
type: string
sample: external
description:
description: The description of the monitor.
returned: changed
type: str
sample: Important Monitor
ip:
description: The new IP of IP/port definition.
returned: changed
@ -163,6 +175,7 @@ try:
from library.module_utils.network.f5.common import fq_name
from library.module_utils.network.f5.common import f5_argument_spec
from library.module_utils.network.f5.common import compare_dictionary
from library.module_utils.network.f5.ipaddress import is_valid_ip
try:
from library.module_utils.network.f5.common import iControlUnexpectedHTTPError
except ImportError:
@ -176,17 +189,12 @@ except ImportError:
from ansible.module_utils.network.f5.common import fq_name
from ansible.module_utils.network.f5.common import f5_argument_spec
from ansible.module_utils.network.f5.common import compare_dictionary
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 = {
@ -197,17 +205,17 @@ class Parameters(AnsibleF5Parameters):
}
api_attributes = [
'defaultsFrom', 'interval', 'timeout', 'destination', 'run', 'args'
'defaultsFrom', 'interval', 'timeout', 'destination', 'run', 'args', 'description'
]
returnables = [
'parent', 'ip', 'port', 'interval', 'timeout', 'variables', 'external_program',
'arguments'
'arguments', 'description'
]
updatables = [
'destination', 'interval', 'timeout', 'variables', 'external_program',
'arguments'
'arguments', 'description'
]
def to_return(self):
@ -256,12 +264,11 @@ class Parameters(AnsibleF5Parameters):
def ip(self):
if self._values['ip'] is None:
return None
try:
if self._values['ip'] in ['*', '0.0.0.0']:
return '*'
result = str(netaddr.IPAddress(self._values['ip']))
return result
except netaddr.core.AddrFormatError:
if self._values['ip'] in ['*', '0.0.0.0']:
return '*'
elif is_valid_ip(self._values['ip']):
return self._values['ip']
else:
raise F5ModuleError(
"The provided 'ip' parameter is not an IP address."
)
@ -609,6 +616,7 @@ class ArgumentSpec(object):
argument_spec = dict(
name=dict(required=True),
parent=dict(default='/Common/external'),
description=dict(),
arguments=dict(),
ip=dict(),
port=dict(type='int'),

@ -28,7 +28,11 @@ options:
- The parent template of this monitor template. Once this value has
been set, it cannot be changed. By default, this value is the C(http)
parent on the C(Common) partition.
default: "/Common/http"
default: /Common/http
description:
description:
- The description of the monitor.
version_added: 2.7
send:
description:
- The send string for the monitor call. When creating a new monitor, if
@ -100,6 +104,7 @@ notes:
extends_documentation_fragment: f5
author:
- Tim Rupp (@caphrim007)
- Wojciech Wypior (@wojtek0806)
'''
EXAMPLES = r'''
@ -140,6 +145,11 @@ parent:
returned: changed
type: string
sample: http
description:
description: The description of the monitor.
returned: changed
type: str
sample: Important_Monitor
ip:
description: The new IP of IP/port definition.
returned: changed
@ -173,6 +183,7 @@ try:
from library.module_utils.network.f5.common import cleanup_tokens
from library.module_utils.network.f5.common import fq_name
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:
@ -185,17 +196,12 @@ except ImportError:
from ansible.module_utils.network.f5.common import cleanup_tokens
from ansible.module_utils.network.f5.common import fq_name
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 = {
@ -207,17 +213,17 @@ class Parameters(AnsibleF5Parameters):
api_attributes = [
'timeUntilUp', 'defaultsFrom', 'interval', 'timeout', 'recv', 'send',
'destination', 'username', 'password', 'recvDisable'
'destination', 'username', 'password', 'recvDisable', 'description'
]
returnables = [
'parent', 'send', 'receive', 'ip', 'port', 'interval', 'timeout',
'time_until_up', 'receive_disable'
'time_until_up', 'receive_disable', 'description'
]
updatables = [
'destination', 'send', 'receive', 'interval', 'timeout', 'time_until_up',
'target_username', 'target_password', 'receive_disable'
'target_username', 'target_password', 'receive_disable', 'description'
]
def to_return(self):
@ -266,12 +272,11 @@ class Parameters(AnsibleF5Parameters):
def ip(self):
if self._values['ip'] is None:
return None
try:
if self._values['ip'] in ['*', '0.0.0.0']:
return '*'
result = str(netaddr.IPAddress(self._values['ip']))
return result
except netaddr.core.AddrFormatError:
if self._values['ip'] in ['*', '0.0.0.0']:
return '*'
elif is_valid_ip(self._values['ip']):
return self._values['ip']
else:
raise F5ModuleError(
"The provided 'ip' parameter is not an IP address."
)
@ -545,6 +550,7 @@ class ArgumentSpec(object):
argument_spec = dict(
name=dict(required=True),
parent=dict(default='/Common/http'),
description=dict(),
send=dict(),
receive=dict(),
receive_disable=dict(required=False),
@ -578,8 +584,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)

@ -23,12 +23,16 @@ options:
description:
- Monitor name.
required: True
description:
description:
- The description of the monitor.
version_added: 2.7
parent:
description:
- The parent template of this monitor template. Once this value has
been set, it cannot be changed. By default, this value is the C(https)
parent on the C(Common) partition.
default: "/Common/https"
default: /Common/https
send:
description:
- The send string for the monitor call. When creating a new monitor, if
@ -99,6 +103,7 @@ notes:
extends_documentation_fragment: f5
author:
- Tim Rupp (@caphrim007)
- Wojciech Wypior (@wojtek0806)
'''
EXAMPLES = r'''
@ -138,6 +143,11 @@ interval:
returned: changed
type: int
sample: 2
description:
description: The description of the monitor.
returned: changed
type: str
sample: Important Monitor
timeout:
description: The new timeout in which the remote system must respond to the monitor.
returned: changed
@ -161,6 +171,7 @@ try:
from library.module_utils.network.f5.common import cleanup_tokens
from library.module_utils.network.f5.common import fq_name
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:
@ -173,17 +184,12 @@ except ImportError:
from ansible.module_utils.network.f5.common import cleanup_tokens
from ansible.module_utils.network.f5.common import fq_name
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 = {
@ -195,17 +201,17 @@ class Parameters(AnsibleF5Parameters):
api_attributes = [
'timeUntilUp', 'defaultsFrom', 'interval', 'timeout', 'recv', 'send',
'destination', 'username', 'password', 'recvDisable'
'destination', 'username', 'password', 'recvDisable', 'description'
]
returnables = [
'parent', 'send', 'receive', 'ip', 'port', 'interval', 'timeout',
'time_until_up', 'receive_disable'
'time_until_up', 'receive_disable', 'description'
]
updatables = [
'destination', 'send', 'receive', 'interval', 'timeout', 'time_until_up',
'target_username', 'target_password', 'receive_disable'
'target_username', 'target_password', 'receive_disable', 'description'
]
def to_return(self):
@ -262,15 +268,13 @@ class Parameters(AnsibleF5Parameters):
def ip(self):
if self._values['ip'] is None:
return None
try:
if self._values['ip'] in ['*', '0.0.0.0']:
return '*'
result = str(netaddr.IPAddress(self._values['ip']))
return result
except netaddr.core.AddrFormatError:
raise F5ModuleError(
"The provided 'ip' parameter is not an IP address."
)
elif self._values['ip'] in ['*', '0.0.0.0']:
return '*'
elif is_valid_ip(self._values['ip']):
return self._values['ip']
raise F5ModuleError(
"The provided 'ip' parameter is not an IP address."
)
@property
def port(self):
@ -530,6 +534,7 @@ class ArgumentSpec(object):
argument_spec = dict(
name=dict(required=True),
parent=dict(default='/Common/https'),
description=dict(),
send=dict(),
receive=dict(),
receive_disable=dict(required=False),
@ -563,8 +568,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)

@ -129,6 +129,7 @@ notes:
extends_documentation_fragment: f5
author:
- Tim Rupp (@caphrim007)
- Wojciech Wypior (@wojtek0806)
'''
EXAMPLES = r'''
@ -157,6 +158,11 @@ parent:
returned: changed
type: string
sample: snmp_dca
description:
description: The description of the monitor.
returned: changed
type: str
sample: Important Monitor
interval:
description: The new interval in which to run the monitor check.
returned: changed
@ -264,7 +270,7 @@ class Parameters(AnsibleF5Parameters):
api_attributes = [
'timeUntilUp', 'defaultsFrom', 'interval', 'timeout', 'destination', 'community',
'version', 'agentType', 'cpuCoefficient', 'cpuThreshold', 'memoryCoefficient',
'memoryThreshold', 'diskCoefficient', 'diskThreshold'
'memoryThreshold', 'diskCoefficient', 'diskThreshold', 'description'
]
returnables = [

@ -29,6 +29,10 @@ options:
been set, it cannot be changed. By default, this value is the C(tcp)
parent on the C(Common) partition.
default: /Common/tcp
description:
description:
- The description of the monitor.
version_added: 2.7
send:
description:
- The send string for the monitor call.
@ -90,6 +94,7 @@ notes:
extends_documentation_fragment: f5
author:
- Tim Rupp (@caphrim007)
- Wojciech Wypior (@wojtek0806)
'''
EXAMPLES = r'''
@ -126,6 +131,11 @@ send:
returned: changed
type: string
sample: tcp string to send
description:
description: The description of the monitor.
returned: changed
type: str
sample: Important Monitor
receive:
description: The new receive string for this monitor.
returned: changed
@ -169,6 +179,7 @@ try:
from library.module_utils.network.f5.common import cleanup_tokens
from library.module_utils.network.f5.common import fq_name
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:
@ -181,17 +192,12 @@ except ImportError:
from ansible.module_utils.network.f5.common import cleanup_tokens
from ansible.module_utils.network.f5.common import fq_name
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 = {
@ -202,16 +208,17 @@ class Parameters(AnsibleF5Parameters):
api_attributes = [
'timeUntilUp', 'defaultsFrom', 'interval', 'timeout', 'recv', 'send',
'destination'
'destination', 'description'
]
returnables = [
'parent', 'send', 'receive', 'ip', 'port', 'interval', 'timeout',
'time_until_up'
'time_until_up', 'description'
]
updatables = [
'destination', 'send', 'receive', 'interval', 'timeout', 'time_until_up'
'destination', 'send', 'receive', 'interval', 'timeout', 'time_until_up',
'description'
]
def to_return(self):
@ -254,12 +261,11 @@ class Parameters(AnsibleF5Parameters):
def ip(self):
if self._values['ip'] is None:
return None
try:
if self._values['ip'] in ['*', '0.0.0.0']:
return '*'
result = str(netaddr.IPAddress(self._values['ip']))
return result
except netaddr.core.AddrFormatError:
if self._values['ip'] in ['*', '0.0.0.0']:
return '*'
if is_valid_ip(self._values['ip']):
return self._values['ip']
else:
raise F5ModuleError(
"The provided 'ip' parameter is not an IP address."
)
@ -536,6 +542,7 @@ class ArgumentSpec(object):
argument_spec = dict(
name=dict(required=True),
parent=dict(default='/Common/tcp'),
description=dict(),
send=dict(),
receive=dict(),
ip=dict(),
@ -566,8 +573,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)

@ -29,6 +29,10 @@ options:
been set, it cannot be changed. By default, this value is the C(tcp_echo)
parent on the C(Common) partition.
default: /Common/tcp_echo
description:
description:
- The description of the monitor.
version_added: 2.7
ip:
description:
- IP address part of the IP/port definition. If this parameter is not
@ -77,6 +81,7 @@ notes:
extends_documentation_fragment: f5
author:
- Tim Rupp (@caphrim007)
- Wojciech Wypior (@wojtek0806)
'''
EXAMPLES = r'''
@ -111,6 +116,11 @@ ip:
returned: changed
type: string
sample: 10.12.13.14
description:
description: The description of the monitor.
returned: changed
type: str
sample: Important Monitor
interval:
description: The new interval in which to run the monitor check.
returned: changed
@ -140,6 +150,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:
@ -151,17 +162,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 = {
@ -170,15 +176,16 @@ class Parameters(AnsibleF5Parameters):
}
api_attributes = [
'timeUntilUp', 'defaultsFrom', 'interval', 'timeout', 'destination'
'timeUntilUp', 'defaultsFrom', 'interval', 'timeout', 'destination',
'description'
]
returnables = [
'parent', 'ip', 'interval', 'timeout', 'time_until_up'
'parent', 'ip', 'interval', 'timeout', 'time_until_up', 'description'
]
updatables = [
'ip', 'interval', 'timeout', 'time_until_up'
'ip', 'interval', 'timeout', 'time_until_up', 'description'
]
def to_return(self):
@ -211,12 +218,11 @@ class Parameters(AnsibleF5Parameters):
def ip(self):
if self._values['ip'] is None:
return None
try:
if self._values['ip'] in ['*', '0.0.0.0']:
return '*'
result = str(netaddr.IPAddress(self._values['ip']))
return result
except netaddr.core.AddrFormatError:
if self._values['ip'] in ['*', '0.0.0.0']:
return '*'
elif is_valid_ip(self._values['ip']):
return self._values['ip']
else:
raise F5ModuleError(
"The provided 'ip' parameter is not an IP address."
)
@ -469,6 +475,7 @@ class ArgumentSpec(object):
argument_spec = dict(
name=dict(required=True),
parent=dict(default='/Common/tcp_echo'),
description=dict(),
ip=dict(),
interval=dict(type='int'),
timeout=dict(type='int'),
@ -496,8 +503,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)

@ -28,7 +28,11 @@ options:
- The parent template of this monitor template. Once this value has
been set, it cannot be changed. By default, this value is the C(tcp_half_open)
parent on the C(Common) partition.
default: "/Common/tcp_half_open"
default: /Common/tcp_half_open
description:
description:
- The description of the monitor.
version_added: 2.7
ip:
description:
- IP address part of the IP/port definition. If this parameter is not
@ -84,6 +88,7 @@ notes:
extends_documentation_fragment: f5
author:
- Tim Rupp (@caphrim007)
- Wojciech Wypior (@wojtek0806)
'''
EXAMPLES = r'''
@ -122,6 +127,11 @@ parent:
returned: changed
type: string
sample: tcp
description:
description: The description of the monitor.
returned: changed
type: str
sample: Important Monitor
ip:
description: The new IP of IP/port definition.
returned: changed
@ -156,6 +166,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:
@ -167,17 +178,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 = {
@ -187,15 +193,17 @@ class Parameters(AnsibleF5Parameters):
}
api_attributes = [
'timeUntilUp', 'defaultsFrom', 'interval', 'timeout', 'destination'
'timeUntilUp', 'defaultsFrom', 'interval', 'timeout', 'destination',
'description'
]
returnables = [
'parent', 'ip', 'port', 'interval', 'timeout', 'time_until_up'
'parent', 'ip', 'port', 'interval', 'timeout', 'time_until_up',
'description'
]
updatables = [
'destination', 'interval', 'timeout', 'time_until_up'
'destination', 'interval', 'timeout', 'time_until_up', 'description'
]
def to_return(self):
@ -244,15 +252,13 @@ class Parameters(AnsibleF5Parameters):
def ip(self):
if self._values['ip'] is None:
return None
try:
if self._values['ip'] in ['*', '0.0.0.0']:
return '*'
result = str(netaddr.IPAddress(self._values['ip']))
return result
except netaddr.core.AddrFormatError:
raise F5ModuleError(
"The provided 'ip' parameter is not an IP address."
)
elif self._values['ip'] in ['*', '0.0.0.0']:
return '*'
elif is_valid_ip(self._values['ip']):
return self._values['ip']
raise F5ModuleError(
"The provided 'ip' parameter is not an IP address."
)
@property
def port(self):
@ -514,6 +520,7 @@ class ArgumentSpec(object):
argument_spec = dict(
name=dict(required=True),
parent=dict(default='/Common/tcp_half_open'),
description=dict(),
ip=dict(),
port=dict(type='int'),
interval=dict(type='int'),
@ -542,8 +549,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)

@ -28,7 +28,11 @@ options:
- The parent template of this monitor template. Once this value has
been set, it cannot be changed. By default, this value is the C(udp)
parent on the C(Common) partition.
default: "/Common/udp"
default: /Common/udp
description:
description:
- The description of the monitor.
version_added: 2.7
send:
description:
- The send string for the monitor call. When creating a new monitor, if
@ -94,6 +98,7 @@ notes:
extends_documentation_fragment: f5
author:
- Tim Rupp (@caphrim007)
- Wojciech Wypior (@wojtek0806)
'''
EXAMPLES = r'''
@ -123,6 +128,11 @@ parent:
returned: changed
type: string
sample: http
description:
description: The description of the monitor.
returned: changed
type: str
sample: Important Monitor
ip:
description: The new IP of IP/port definition.
returned: changed
@ -157,6 +167,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:
@ -168,17 +179,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 = {
@ -189,16 +195,17 @@ class Parameters(AnsibleF5Parameters):
api_attributes = [
'timeUntilUp', 'defaultsFrom', 'interval', 'timeout', 'recv', 'send',
'destination'
'destination', 'description'
]
returnables = [
'parent', 'send', 'receive', 'ip', 'port', 'interval', 'timeout',
'time_until_up'
'time_until_up', 'description'
]
updatables = [
'destination', 'send', 'receive', 'interval', 'timeout', 'time_until_up'
'destination', 'send', 'receive', 'interval', 'timeout', 'time_until_up',
'description'
]
def to_return(self):
@ -247,12 +254,11 @@ class Parameters(AnsibleF5Parameters):
def ip(self):
if self._values['ip'] is None:
return None
try:
if self._values['ip'] in ['*', '0.0.0.0']:
return '*'
result = str(netaddr.IPAddress(self._values['ip']))
return result
except netaddr.core.AddrFormatError:
if self._values['ip'] in ['*', '0.0.0.0']:
return '*'
elif is_valid_ip(self._values['ip']):
return self._values['ip']
else:
raise F5ModuleError(
"The provided 'ip' parameter is not an IP address."
)
@ -518,6 +524,7 @@ class ArgumentSpec(object):
argument_spec = dict(
name=dict(required=True),
parent=dict(default='/Common/udp'),
description=dict(),
send=dict(),
receive=dict(),
receive_disable=dict(required=False),
@ -549,8 +556,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)

Loading…
Cancel
Save