Bug Fixes for ontap_net_vlan.py (#44209)

* Bug Fixes for ontap_net_vlan.py

* Make documentation changes
pull/4420/head
Chris Archibald 2018-08-22 09:00:49 -07:00 committed by John R Barker
parent 00143d806c
commit 66ae8efbd3
2 changed files with 10 additions and 23 deletions

View File

@ -184,6 +184,8 @@ Noteworthy module changes
* ``frequency``, use ``type``, in a triggers entry instead * ``frequency``, use ``type``, in a triggers entry instead
* ``time``, use ``start_boundary`` in a triggers entry instead * ``time``, use ``start_boundary`` in a triggers entry instead
* The ``interface_name`` module option for ``na_ontap_net_vlan`` has been removed and should be removed from your playbooks
Plugins Plugins
======= =======

View File

@ -12,11 +12,11 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = ''' DOCUMENTATION = '''
module: na_ontap_net_vlan module: na_ontap_net_vlan
short_description: Manage NetApp Ontap network vlan short_description: Manage NetApp ONTAP network vlan
extends_documentation_fragment: extends_documentation_fragment:
- netapp.ontap - netapp.ontap
version_added: '2.6' version_added: '2.6'
author: Chris Archibald (carchi@netapp.com), Kevin Hutton (khutton@netapp.com) author: NetApp Ansible Team (ng-ansibleteam@netapp.com)
description: description:
- Create or Delete a network vlan - Create or Delete a network vlan
options: options:
@ -36,13 +36,9 @@ options:
node: node:
description: description:
- Node name of vlan interface. - Node name of vlan interface.
interface_name: required: true
description: notes:
- Name of vlan interface. The name must be of the format <parent-inteface>-<vlanid> - The C(interface_name) option has been removed and should be deleted from playbooks
gvrp_enabled:
type: bool
description:
- GVRP is deprecated and this attribute is ignored in cluster mode.
''' '''
EXAMPLES = """ EXAMPLES = """
@ -81,8 +77,6 @@ class NetAppOntapVlan(object):
parent_interface=dict(required=True, type='str'), parent_interface=dict(required=True, type='str'),
vlanid=dict(required=True, type='str'), vlanid=dict(required=True, type='str'),
node=dict(required=True, type='str'), node=dict(required=True, type='str'),
interface_name=dict(required=False, type='str'),
gvrp_enabled=dict(required=False, type='bool', default=False),
)) ))
self.module = AnsibleModule( self.module = AnsibleModule(
@ -96,8 +90,7 @@ class NetAppOntapVlan(object):
self.parent_interface = p['parent_interface'] self.parent_interface = p['parent_interface']
self.vlanid = p['vlanid'] self.vlanid = p['vlanid']
self.node = p['node'] self.node = p['node']
self.interface_name = p['interface_name'] self.interface_name = str(p['parent_interface']) + '-' + str(self.vlanid)
self.gvrp_enabled = p['gvrp_enabled']
if HAS_NETAPP_LIB is False: if HAS_NETAPP_LIB is False:
self.module.fail_json(msg="the python NetApp-Lib module is required") self.module.fail_json(msg="the python NetApp-Lib module is required")
@ -131,7 +124,7 @@ class NetAppOntapVlan(object):
:return: Returns True if the vlan exists, false if it dosn't :return: Returns True if the vlan exists, false if it dosn't
""" """
vlan_obj = netapp_utils.zapi.NaElement("net-vlan-get") vlan_obj = netapp_utils.zapi.NaElement("net-vlan-get")
vlan_obj.add_new_child("interface-name", self.parent_interface + "-" + self.vlanid) vlan_obj.add_new_child("interface-name", self.interface_name)
vlan_obj.add_new_child("node", self.node) vlan_obj.add_new_child("node", self.node)
try: try:
result = self.server.invoke_successfully(vlan_obj, True) result = self.server.invoke_successfully(vlan_obj, True)
@ -150,15 +143,7 @@ class NetAppOntapVlan(object):
# set up the vlan_info object: # set up the vlan_info object:
vlan_info.add_new_child("parent-interface", self.parent_interface) vlan_info.add_new_child("parent-interface", self.parent_interface)
vlan_info.add_new_child("vlanid", self.vlanid) vlan_info.add_new_child("vlanid", self.vlanid)
# add the optional line if they exist. vlan_info.add_new_child("node", self.node)
if self.node:
vlan_info.add_new_child("node", self.node)
if self.interface_name:
vlan_info.add_new_child("interface-name", self.interface_name)
if self.gvrp_enabled:
vlan_info.add_new_child("gvrp-enabled", 'true')
else:
vlan_info.add_new_child("gvrp-enabled", 'false')
return vlan_info return vlan_info
def apply(self): def apply(self):