added route domain support (#61077)

added diff functionality
pull/60571/head
Wojciech Wypior 5 years ago committed by Tim Rupp
parent 3e1f35155c
commit 62feb18210

@ -40,7 +40,7 @@ options:
type: int type: int
description: description:
description: description:
- Description of snat-translation. c(none or '') will set to default description of null. - Description of snat-translation. C(none or '') will set to default description of null.
type: str type: str
ip_idle_timeout: ip_idle_timeout:
description: description:
@ -58,7 +58,7 @@ options:
partition: partition:
description: description:
- Device partition to manage resources on. - Device partition to manage resources on.
- Required with state c(absent) when partiition other than Common used. - Required with state C(absent) when partition other than Common used.
type: str type: str
state: state:
description: description:
@ -98,6 +98,7 @@ options:
extends_documentation_fragment: f5 extends_documentation_fragment: f5
author: author:
- Greg Crosby (@crosbygw) - Greg Crosby (@crosbygw)
- Wojciech Wypior (@wojtek0806)
''' '''
EXAMPLES = r''' EXAMPLES = r'''
@ -245,7 +246,7 @@ udp_idle_timeout:
type: str type: str
sample: indifinite sample: indifinite
''' '''
import os
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.basic import env_fallback from ansible.module_utils.basic import env_fallback
@ -362,19 +363,24 @@ class ModuleParameters(Parameters):
if 0 <= int(limit) <= 65535: if 0 <= int(limit) <= 65535:
return int(limit) return int(limit)
raise F5ModuleError( raise F5ModuleError(
"Valid 'maximum_age' must be in range 0 - 65535." "Valid 'connection_limit' must be in range 0 - 65535."
) )
@property @property
def address(self): def address(self):
if self._values['address'] is None: if self._values['address'] is None:
return None return None
if is_valid_ip(self._values['address']): if len(self._values['address'].split('%')) > 1:
return compress_address(self._values['address']) address, rd = self._values['address'].split('%')
if is_valid_ip(address):
result = '{0}%{1}'.format(compress_address(address), rd)
return result
else: else:
raise F5ModuleError( if is_valid_ip(self._values['address']):
"The provided 'address' is not a valid IP address" return self._values['address']
) raise F5ModuleError(
"The provided address: {0} is not a valid IP address".format(self._values['address'])
)
@property @property
def arp(self): def arp(self):
@ -564,8 +570,25 @@ class ModuleManager(object):
reportable = ReportableChanges(params=self.changes.to_return()) reportable = ReportableChanges(params=self.changes.to_return())
changes = reportable.to_return() changes = reportable.to_return()
result.update(**changes) result.update(**changes)
if self.module._diff and self.have:
result['diff'] = self.make_diff()
result.update(dict(changed=changed)) result.update(dict(changed=changed))
self._announce_deprecations(result) self._announce_deprecations(result)
return result
def _grab_attr(self, item):
result = dict()
updatables = Parameters.updatables
for k in updatables:
if getattr(item, k) is not None:
result[k] = getattr(item, k)
return result
def make_diff(self):
result = dict(before=self._grab_attr(self.have), after=self._grab_attr(self.want))
return result return result
def present(self): def present(self):

Loading…
Cancel
Save