From 5173548a9fb53843ed99a283c8c8b21ea9710418 Mon Sep 17 00:00:00 2001 From: Chris Archibald Date: Thu, 28 Mar 2019 10:35:34 -0700 Subject: [PATCH] bug fix to na_ontap_interface (#54469) * bug fix * Update lib/ansible/modules/storage/netapp/na_ontap_interface.py Co-Authored-By: carchi8py --- .../storage/netapp/na_ontap_interface.py | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/lib/ansible/modules/storage/netapp/na_ontap_interface.py b/lib/ansible/modules/storage/netapp/na_ontap_interface.py index 4df4f2f3682..5ab14ab513e 100644 --- a/lib/ansible/modules/storage/netapp/na_ontap_interface.py +++ b/lib/ansible/modules/storage/netapp/na_ontap_interface.py @@ -156,26 +156,27 @@ class NetAppOntapInterface(object): def __init__(self): self.argument_spec = netapp_utils.na_ontap_host_argument_spec() - self.argument_spec.update( - state=dict(type='str', default='present', choices=['absent', 'present']), - interface_name=dict(type='str', required=True), - home_node=dict(type='str'), - home_port=dict(type='str'), - role=dict(type='str'), - address=dict(type='str'), - netmask=dict(type='str'), - vserver=dict(type='str', required=True), - firewall_policy=dict(type='str'), - failover_policy=dict(type='str'), - admin_status=dict(type='str', choices=['up', 'down']), - subnet_name=dict(type='str'), - is_auto_revert=dict(type='bool'), - protocols=dict(type='list'), - ) + self.argument_spec.update(dict( + state=dict(required=False, choices=[ + 'present', 'absent'], default='present'), + interface_name=dict(required=True, type='str'), + home_node=dict(required=False, type='str', default=None), + home_port=dict(required=False, type='str'), + role=dict(required=False, type='str'), + address=dict(required=False, type='str'), + netmask=dict(required=False, type='str'), + vserver=dict(required=True, type='str'), + firewall_policy=dict(required=False, type='str', default=None), + failover_policy=dict(required=False, type='str', default=None), + admin_status=dict(required=False, choices=['up', 'down']), + subnet_name=dict(required=False, type='str'), + is_auto_revert=dict(required=False, type='bool', default=None), + protocols=dict(required=False, type='list') + )) self.module = AnsibleModule( argument_spec=self.argument_spec, - supports_check_mode=True, + supports_check_mode=True ) self.na_helper = NetAppModule() self.parameters = self.na_helper.set_parameters(self.module.params) @@ -250,7 +251,7 @@ class NetAppOntapInterface(object): if self.parameters.get('protocols') is not None: data_protocols_obj = netapp_utils.zapi.NaElement('data-protocols') for protocol in self.parameters.get('protocols'): - if protocol.lower() == 'fc-nvme': + if protocol.lower() in ['fc-nvme', 'fcp']: required_keys.remove('address') required_keys.remove('home_port') required_keys.remove('netmask')