From 5673482460d225a0f1591c2d7864b834d719f6ef Mon Sep 17 00:00:00 2001 From: Chris Archibald Date: Tue, 6 Aug 2019 14:53:29 -0700 Subject: [PATCH] bug fix (#60140) --- .../modules/storage/netapp/na_ontap_interface.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/ansible/modules/storage/netapp/na_ontap_interface.py b/lib/ansible/modules/storage/netapp/na_ontap_interface.py index bf889ebf886..e25745e09bf 100644 --- a/lib/ansible/modules/storage/netapp/na_ontap_interface.py +++ b/lib/ansible/modules/storage/netapp/na_ontap_interface.py @@ -267,9 +267,12 @@ class NetAppOntapInterface(object): data_protocols_obj = netapp_utils.zapi.NaElement('data-protocols') for protocol in self.parameters.get('protocols'): if protocol.lower() in ['fc-nvme', 'fcp']: - required_keys.remove('address') - required_keys.remove('home_port') - required_keys.remove('netmask') + if 'address' in required_keys: + required_keys.remove('address') + if 'home_port' in required_keys: + required_keys.remove('home_port') + if 'netmask' in required_keys: + required_keys.remove('netmask') not_required_params = set(['address', 'netmask', 'firewall_policy']) if not not_required_params.isdisjoint(set(self.parameters.keys())): self.module.fail_json(msg='Error: Following parameters for creating interface are not supported' @@ -324,7 +327,7 @@ class NetAppOntapInterface(object): if self.parameters.get('subnet_name') is None: required_keys.add('address') required_keys.add('netmask') - data_protocols_obj = self.set_protocol_option(required_keys) + data_protocols_obj = self.set_protocol_option(required_keys) self.validate_create_parameters(required_keys) options = {'interface-name': self.parameters['interface_name'],