Adds parameters to ike_peer module (#48514)

pull/48515/head
Tim Rupp 6 years ago committed by GitHub
parent a260e86729
commit 365ecbd7ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -24,6 +24,9 @@ options:
description: description:
- Specifies the name of the IKE peer. - Specifies the name of the IKE peer.
required: True required: True
description:
description:
- Description of the IKE peer.
version: version:
description: description:
- Specifies which version of IKE is used. - Specifies which version of IKE is used.
@ -174,6 +177,7 @@ options:
extends_documentation_fragment: f5 extends_documentation_fragment: f5
author: author:
- Tim Rupp (@caphrim007) - Tim Rupp (@caphrim007)
- Wojciech Wypior (@wojtek0806)
''' '''
EXAMPLES = r''' EXAMPLES = r'''
@ -269,6 +273,7 @@ try:
from library.module_utils.network.f5.common import fail_json from library.module_utils.network.f5.common import fail_json
from library.module_utils.network.f5.common import transform_name from library.module_utils.network.f5.common import transform_name
from library.module_utils.network.f5.common import flatten_boolean from library.module_utils.network.f5.common import flatten_boolean
from library.module_utils.network.f5.compare import cmp_str_with_none
except ImportError: except ImportError:
from ansible.module_utils.network.f5.bigip import F5RestClient from ansible.module_utils.network.f5.bigip import F5RestClient
from ansible.module_utils.network.f5.common import F5ModuleError from ansible.module_utils.network.f5.common import F5ModuleError
@ -280,6 +285,7 @@ except ImportError:
from ansible.module_utils.network.f5.common import fail_json from ansible.module_utils.network.f5.common import fail_json
from ansible.module_utils.network.f5.common import transform_name from ansible.module_utils.network.f5.common import transform_name
from ansible.module_utils.network.f5.common import flatten_boolean from ansible.module_utils.network.f5.common import flatten_boolean
from ansible.module_utils.network.f5.compare import cmp_str_with_none
class Parameters(AnsibleF5Parameters): class Parameters(AnsibleF5Parameters):
@ -315,6 +321,7 @@ class Parameters(AnsibleF5Parameters):
'verifyCert', 'verifyCert',
'peersIdValue', 'peersIdValue',
'myIdValue', 'myIdValue',
'description',
] ]
returnables = [ returnables = [
@ -332,6 +339,7 @@ class Parameters(AnsibleF5Parameters):
'phase1_verify_peer_cert', 'phase1_verify_peer_cert',
'verified_id_value', 'verified_id_value',
'presented_id_value', 'presented_id_value',
'description',
] ]
updatables = [ updatables = [
@ -349,6 +357,7 @@ class Parameters(AnsibleF5Parameters):
'phase1_verify_peer_cert', 'phase1_verify_peer_cert',
'verified_id_value', 'verified_id_value',
'presented_id_value', 'presented_id_value',
'description',
] ]
@property @property
@ -357,7 +366,11 @@ class Parameters(AnsibleF5Parameters):
class ApiParameters(Parameters): class ApiParameters(Parameters):
pass @property
def description(self):
if self._values['description'] in [None, 'none']:
return None
return self._values['description']
class ModuleParameters(Parameters): class ModuleParameters(Parameters):
@ -377,6 +390,14 @@ class ModuleParameters(Parameters):
return '' return ''
return fq_name(self.partition, self._values['phase1_key']) return fq_name(self.partition, self._values['phase1_key'])
@property
def description(self):
if self._values['description'] is None:
return None
elif self._values['description'] in ['none', '']:
return ''
return self._values['description']
class Changes(Parameters): class Changes(Parameters):
def to_return(self): def to_return(self):
@ -432,6 +453,10 @@ class Difference(object):
except AttributeError: except AttributeError:
return attr1 return attr1
@property
def description(self):
return cmp_str_with_none(self.want.description, self.have.description)
class ModuleManager(object): class ModuleManager(object):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
@ -695,6 +720,7 @@ class ArgumentSpec(object):
default='always', default='always',
choices=['always', 'on_create'] choices=['always', 'on_create']
), ),
description=dict(),
state=dict(default='present', choices=['absent', 'present']), state=dict(default='present', choices=['absent', 'present']),
partition=dict( partition=dict(
default='Common', default='Common',
@ -730,8 +756,9 @@ def main():
required_together=spec.required_together, required_together=spec.required_together,
) )
try:
client = F5RestClient(**module.params) client = F5RestClient(**module.params)
try:
mm = ModuleManager(module=module, client=client) mm = ModuleManager(module=module, client=client)
results = mm.exec_module() results = mm.exec_module()
cleanup_tokens(client) cleanup_tokens(client)

Loading…
Cancel
Save