From 00143d806c34ad795263a52c2dd4cfd518b0ede7 Mon Sep 17 00:00:00 2001 From: Chris Archibald Date: Wed, 22 Aug 2018 08:59:26 -0700 Subject: [PATCH] Bug Fixes for ontap_snapshot.py (#44216) --- .../storage/netapp/na_ontap_snapshot.py | 23 ++++++------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/lib/ansible/modules/storage/netapp/na_ontap_snapshot.py b/lib/ansible/modules/storage/netapp/na_ontap_snapshot.py index fac6a2160e..907ad9115d 100644 --- a/lib/ansible/modules/storage/netapp/na_ontap_snapshot.py +++ b/lib/ansible/modules/storage/netapp/na_ontap_snapshot.py @@ -18,10 +18,9 @@ short_description: Manage NetApp Sanpshots extends_documentation_fragment: - netapp.na_ontap version_added: '2.6' -author: -- Chris Archibald (carchi@netapp.com), Kevin Hutton (khutton@netapp.com) +author: NetApp Ansible Team (ng-ansibleteam@netapp.com) description: -- Create/Modify/Delete Ontap snapshots +- Create/Modify/Delete ONTAP snapshots options: state: description: @@ -60,11 +59,6 @@ options: vserver: description: - The Vserver name - new_comment: - description: - A human readable comment attached with the snapshot. - The size of the comment can be at most 255 characters. - This will replace the existing comment ''' EXAMPLES = """ - name: create SnapShot @@ -96,7 +90,7 @@ EXAMPLES = """ na_ontap_snapshot: state=present snapshot={{ snapshot name }} - new_comment="New comments are great" + comment="New comments are great" volume={{ vol name }} vserver={{ vserver name }} username={{ netapp username }} @@ -133,7 +127,6 @@ class NetAppOntapSnapshot(object): ignore_owners=dict(required=False, type="bool", default=False), snapshot_instance_uuid=dict(required=False, type="str"), vserver=dict(required=True, type="str"), - new_comment=dict(required=False, type="str"), )) self.module = AnsibleModule( @@ -156,9 +149,6 @@ class NetAppOntapSnapshot(object): # these are the optional variables for deleting a snapshot\ self.ignore_owners = parameters['ignore_owners'] self.snapshot_instance_uuid = parameters['snapshot_instance_uuid'] - # These are the optional for Modify. - # You can NOT change a snapcenter name - self.new_comment = parameters['new_comment'] if HAS_NETAPP_LIB is False: self.module.fail_json( @@ -231,7 +221,8 @@ class NetAppOntapSnapshot(object): attributes = netapp_utils.zapi.NaElement("attributes") snapshot_info_obj = netapp_utils.zapi.NaElement("snapshot-info") snapshot_info_obj.add_new_child("name", self.snapshot) - snapshot_info_obj.add_new_child("comment", self.new_comment) + if self.comment is not None: + snapshot_info_obj.add_new_child("comment", self.comment) attributes.add_child_elem(snapshot_info_obj) snapshot_obj.add_child_elem(attributes) try: @@ -283,8 +274,8 @@ class NetAppOntapSnapshot(object): if existing_snapshot is not None: if self.state == 'absent': changed = True - elif self.state == 'present' and self.new_comment: - if existing_snapshot['comment'] != self.new_comment: + elif self.state == 'present' and self.comment is not None: + if existing_snapshot['comment'] != self.comment: comment_changed = True changed = True else: