Skip to content

Commit

Permalink
Exclude DNS View from filter criteria when configure_for_dns is false (
Browse files Browse the repository at this point in the history
#229)

* Exclude DNS View from filter criteria when configure_for_dns is false

This logic was already applied to scenarios that were not updating a name (lines 715-719). This commit simply applies the same logic to scenarios where names are being updated.

Signed-off-by: David Ehrman <[email protected]>

* Add changelog fragment

Signed-off-by: David Ehrman <[email protected]>

---------

Signed-off-by: David Ehrman <[email protected]>
  • Loading branch information
dlehrman authored Aug 22, 2024
1 parent 10cb08a commit b1623bc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions changelogs/fragments/229-handle-host-rename-without-dns.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
bugfixes:
- nios_host_record - rename logic included DNS view in filter critera, even when DNS had been bypassed. Omits DNS view from filter critera when renaming a host object and DNS is bypassed. (https://github.com/infobloxopen/infoblox-ansible/issues/230)
...
6 changes: 5 additions & 1 deletion plugins/module_utils/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,11 @@ def get_object_ref(self, module, ib_obj_type, obj_filter, ib_spec):

if old_name and new_name:
if (ib_obj_type == NIOS_HOST_RECORD):
test_obj_filter = dict([('name', old_name), ('view', obj_filter['view'])])
# to check only by old_name if dns bypassing is set
if not obj_filter['configure_for_dns']:
test_obj_filter = dict([('name', old_name)])
else:
test_obj_filter = dict([('name', old_name), ('view', obj_filter['view'])])
# if there are multiple records with same name and different ip
elif (ib_obj_type == NIOS_A_RECORD):
test_obj_filter = dict([('name', old_name), ('ipv4addr', obj_filter['ipv4addr'])])
Expand Down

0 comments on commit b1623bc

Please sign in to comment.