1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

PR to fix the bug 57215 & 56300 under Nios Host_Record module (#57221)

* fix bug 57215 & 56300

Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>

* fix bug 57215 & 56300

Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>

* shippable error fix

Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>

* review comment fix

Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
This commit is contained in:
Sumit Jaiswal 2019-06-04 10:52:16 +05:30 committed by GitHub
parent 78f6a7cbb1
commit e620e27609
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -265,17 +265,34 @@ class WapiModule(WapiBase):
else:
proposed_object[key] = self.module.params[key]
# If configure_by_dns is set to False, then delete the default dns set in the param else throw exception
if not proposed_object.get('configure_for_dns') and proposed_object.get('view') == 'default'\
and ib_obj_type == NIOS_HOST_RECORD:
del proposed_object['view']
elif not proposed_object.get('configure_for_dns') and proposed_object.get('view') != 'default'\
and ib_obj_type == NIOS_HOST_RECORD:
self.module.fail_json(msg='DNS Bypass is not allowed if DNS view is set other than \'default\'')
if ib_obj_ref:
if len(ib_obj_ref) > 1:
for each in ib_obj_ref:
if ('ipv4addr' in each) and ('ipv4addr' in proposed_object)\
and each['ipv4addr'] == proposed_object['ipv4addr']:
# 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'):
current_object = each
# To check for existing Host_record with same name with input Host_record by IP
elif each.get('ipv4addrs')[0].get('ipv4addr') and each.get('ipv4addrs')[0].get('ipv4addr')\
== proposed_object.get('ipv4addrs')[0].get('ipv4addr'):
current_object = each
# Else set the current_object with input value
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'])
ref = current_object.pop('_ref')
if current_object.get('_ref'):
ref = current_object.pop('_ref')
else:
current_object = obj_filter
ref = None