fixes an edge case where order of devices parameters breaks idempotency (#55181)

code correction for aggregates in bigip_gtm_pool_member and bigip_pool to be in line with established patterns
pull/55195/head
Wojciech Wypior 6 years ago committed by Tim Rupp
parent 30a216bf78
commit adc0d2cd83

@ -606,9 +606,8 @@ class ModuleManager(object):
self.want = None
self.have = None
self.changes = None
self.replace_all_with = False
self.replace_all_with = None
self.purge_links = list()
self.on_device = None
def _set_changed_options(self):
changed = {}
@ -711,7 +710,7 @@ class ModuleManager(object):
if diff:
to_purge = [item['selfLink'] for item in on_device if self._transform_api_names(item) in diff]
self.purge_links = to_purge
self.purge_links.extend(to_purge)
def execute(self, params=None):
self.want = ModuleParameters(params=params)

@ -1157,10 +1157,22 @@ class Difference(object):
)
want = [OrderedDict(sorted(d.items())) for d in devices]
have = [OrderedDict(sorted(d.items())) for d in have_devices]
if len(have_devices) > 0:
if self._false_positive(devices, have_devices):
return False
if want != have:
return True
return False
def _false_positive(self, devices, have_devices):
match = 0
for w in devices:
for h in have_devices:
if w.items() == h.items():
match = match + 1
if match == len(devices):
return True
def _server_type_changed(self):
if self.want.server_type is None:
self.want.update({'server_type': self.have.server_type})

@ -814,8 +814,8 @@ class ModuleManager(object):
self.want = None
self.have = None
self.changes = None
self.replace_all_with = False
self.purge_links = None
self.replace_all_with = None
self.purge_links = list()
def exec_module(self):
wants = None
@ -874,7 +874,7 @@ class ModuleManager(object):
if diff:
to_purge = [item['selfLink'] for item in on_device if item['name'] in diff]
self.purge_links = to_purge
self.purge_links.extend(to_purge)
def execute(self, params=None):
self.want = ModuleParameters(params=params)

Loading…
Cancel
Save