From 2fab2d57756af72496d186d75a5ae5b59951d34b Mon Sep 17 00:00:00 2001 From: Milan Zink Date: Tue, 28 Aug 2018 13:25:16 +0200 Subject: [PATCH] Fixing missing modify_client_match function and get_export_policy_rule function logic (#44164) --- .../netapp/na_ontap_export_policy_rule.py | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/storage/netapp/na_ontap_export_policy_rule.py b/lib/ansible/modules/storage/netapp/na_ontap_export_policy_rule.py index b1f7ff9e23..cf0317c359 100644 --- a/lib/ansible/modules/storage/netapp/na_ontap_export_policy_rule.py +++ b/lib/ansible/modules/storage/netapp/na_ontap_export_policy_rule.py @@ -203,9 +203,9 @@ class NetAppontapExportRule(object): rule_info.add_new_child('policy-name', self.policy_name) if self.vserver: rule_info.add_new_child('vserver-name', self.vserver) - else: - if self.client_match: - rule_info.add_new_child('client-match', self.client_match) + + if self.client_match: + rule_info.add_new_child('client-match', self.client_match) query = netapp_utils.zapi.NaElement('query') query.add_child_elem(rule_info) @@ -254,6 +254,7 @@ class NetAppontapExportRule(object): return_value = { 'policy-name': self.policy_name } + return return_value def get_export_policy(self): @@ -422,6 +423,22 @@ class NetAppontapExportRule(object): self.module.fail_json(msg='Error modifying super_user_security %s: %s' % (self.super_user_security, to_native(error)), exception=traceback.format_exc()) + def modify_client_match(self, rule_index): + """ + Modify client_match. + """ + export_rule_modify_client_match = netapp_utils.zapi.NaElement.create_node_with_children( + 'export-rule-modify', + **{'policy-name': self.policy_name, + 'rule-index': rule_index, + 'client-match': str(self.client_match)}) + try: + self.server.invoke_successfully(export_rule_modify_client_match, + enable_tunneling=True) + except netapp_utils.zapi.NaApiError as error: + self.module.fail_json(msg='Error modifying client_match %s: %s' % (self.client_match, to_native(error)), + exception=traceback.format_exc()) + def modify_allow_suid(self, rule_index): """ Modify allow_suid.