From 545ed0dba1500621cb7ad3d8b458e132c05214fd Mon Sep 17 00:00:00 2001 From: albinpopote Date: Wed, 13 Mar 2019 19:29:08 +0100 Subject: [PATCH] na_ontap_dns: Add new parameter skip_validation (#50458) * Add new parameter skip_validation * Change file indentation * Indentation fix * Change module documentation * Contributor change request : fixed * FIX : Validator change request * Comment: Add more description details about skip_validation option --- .../modules/storage/netapp/na_ontap_dns.py | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/storage/netapp/na_ontap_dns.py b/lib/ansible/modules/storage/netapp/na_ontap_dns.py index e8fc344c078..d9e0ef24625 100644 --- a/lib/ansible/modules/storage/netapp/na_ontap_dns.py +++ b/lib/ansible/modules/storage/netapp/na_ontap_dns.py @@ -40,6 +40,13 @@ options: description: - List of IPv4 addresses of name servers such as '123.123.123.123'. + skip_validation: + type: bool + description: + - By default, all nameservers are checked to validate they are available to resolve. + - If you DNS servers are not yet installed or momentarily not available, you can set this option to 'true' + - to bypass the check for all servers specified in nameservers field. + version_added: '2.8' ''' EXAMPLES = """ @@ -52,6 +59,7 @@ EXAMPLES = """ vserver: "{{vservername}}" domains: sales.bar.com nameservers: 10.193.0.250,10.192.0.250 + skip_validation: true """ RETURN = """ @@ -77,7 +85,8 @@ class NetAppOntapDns(object): state=dict(required=False, choices=['present', 'absent'], default='present'), vserver=dict(required=True, type='str'), domains=dict(required=False, type='list'), - nameservers=dict(required=False, type='list') + nameservers=dict(required=False, type='list'), + skip_validation=dict(required=False, type='bool') )) self.module = AnsibleModule( @@ -112,6 +121,10 @@ class NetAppOntapDns(object): domain.set_content(each) domains.add_child_elem(domain) dns.add_child_elem(domains) + if self.parameters.get('skip_validation'): + validation = netapp_utils.zapi.NaElement('skip-config-validation') + validation.set_content(str(self.parameters['skip_validation'])) + dns.add_child_elem(validation) try: self.server.invoke_successfully(dns, True) except netapp_utils.zapi.NaApiError as error: @@ -151,6 +164,7 @@ class NetAppOntapDns(object): attrs['nameservers'] = [each.get_content() for each in nameservers.get_children()] domains = dns_info.get_child_by_name('domains') attrs['domains'] = [each.get_content() for each in domains.get_children()] + attrs['skip_validation'] = dns_info.get_child_by_name('skip-config-validation') return attrs def modify_dns(self, dns_attrs): @@ -173,6 +187,10 @@ class NetAppOntapDns(object): domains.add_child_elem(domain) dns.add_child_elem(domains) if changed: + if self.parameters.get('skip_validation'): + validation = netapp_utils.zapi.NaElement('skip-config-validation') + validation.set_content(str(self.parameters['skip_validation'])) + dns.add_child_elem(validation) try: self.server.invoke_successfully(dns, True) except netapp_utils.zapi.NaApiError as error: