mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Make irules module idempotent (#3175)
The irules module was failing to strip whitespace that is, for some reason, automatically inserted by BIG-IP. This patch adds necessary strips
This commit is contained in:
parent
960f28692e
commit
0055360315
1 changed files with 5 additions and 8 deletions
|
@ -202,7 +202,7 @@ class BigIpiRule(object):
|
||||||
)
|
)
|
||||||
|
|
||||||
if hasattr(r, 'apiAnonymous'):
|
if hasattr(r, 'apiAnonymous'):
|
||||||
p['content'] = str(r.apiAnonymous)
|
p['content'] = str(r.apiAnonymous.strip())
|
||||||
p['name'] = name
|
p['name'] = name
|
||||||
return p
|
return p
|
||||||
|
|
||||||
|
@ -246,14 +246,10 @@ class BigIpiRule(object):
|
||||||
)
|
)
|
||||||
|
|
||||||
def present(self):
|
def present(self):
|
||||||
changed = False
|
|
||||||
|
|
||||||
if self.exists():
|
if self.exists():
|
||||||
changed = self.update()
|
return self.update()
|
||||||
else:
|
else:
|
||||||
changed = self.create()
|
return self.create()
|
||||||
|
|
||||||
return changed
|
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
params = dict()
|
params = dict()
|
||||||
|
@ -267,6 +263,7 @@ class BigIpiRule(object):
|
||||||
module = self.params['module']
|
module = self.params['module']
|
||||||
|
|
||||||
if content is not None:
|
if content is not None:
|
||||||
|
content = content.strip()
|
||||||
if 'content' in current:
|
if 'content' in current:
|
||||||
if content != current['content']:
|
if content != current['content']:
|
||||||
params['apiAnonymous'] = content
|
params['apiAnonymous'] = content
|
||||||
|
@ -318,7 +315,7 @@ class BigIpiRule(object):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if content is not None:
|
if content is not None:
|
||||||
params['apiAnonymous'] = content
|
params['apiAnonymous'] = content.strip()
|
||||||
|
|
||||||
params['name'] = name
|
params['name'] = name
|
||||||
params['partition'] = partition
|
params['partition'] = partition
|
||||||
|
|
Loading…
Reference in a new issue