Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/second hostrecord with same hostname option 2 #203

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/two_hostrecords_same_hostname.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- nios_host_record - "if len(ib_obj_ref) > 1" in module_utils/api.py results in weird behaviour. Changed to "if len(ib_obj_ref) >= 1" and deleted the corresponding else-statement.
4 changes: 1 addition & 3 deletions plugins/module_utils/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ def run(self, ib_obj_type, ib_spec):
del proposed_object['view']

if ib_obj_ref:
if len(ib_obj_ref) > 1:
if len(ib_obj_ref) >= 1:
for each in ib_obj_ref:
# To check for existing A_record with same name with input A_record by IP
if each.get('ipv4addr') and each.get('ipv4addr') == proposed_object.get('ipv4addr'):
Expand All @@ -340,8 +340,6 @@ def run(self, ib_obj_type, ib_spec):
else:
current_object = obj_filter
ref = None
else:
current_object = ib_obj_ref[0]
if 'extattrs' in current_object:
current_object['extattrs'] = flatten_extattrs(current_object['extattrs'])
if current_object.get('_ref'):
Expand Down