Bug Fixes for ontap_user.py (#44222)

This commit is contained in:
Chris Archibald 2018-08-17 06:21:50 -07:00 committed by ansibot
commit 374a22f4c7

View file

@ -20,7 +20,7 @@ short_description: useradmin configuration and management
extends_documentation_fragment: extends_documentation_fragment:
- netapp.na_ontap - netapp.na_ontap
version_added: '2.6' version_added: '2.6'
author: Sumit Kumar (sumit4@netapp.com) author: NetApp Ansible Team (ng-ansibleteam@netapp.com)
description: description:
- Create or destroy users. - Create or destroy users.
@ -42,7 +42,7 @@ options:
description: description:
- Application to grant access to. - Application to grant access to.
required: true required: true
choices: ['console', 'http','ontapi','rsh','snmp','sp','ssh','telnet'] choices: ['console', 'http','ontapi','rsh','snmp','service-processor','sp','ssh','telnet']
authentication_method: authentication_method:
description: description:
@ -127,7 +127,7 @@ class NetAppOntapUser(object):
application=dict(required=True, type='str', choices=[ application=dict(required=True, type='str', choices=[
'console', 'http', 'ontapi', 'rsh', 'console', 'http', 'ontapi', 'rsh',
'snmp', 'sp', 'ssh', 'telnet']), 'snmp', 'sp', 'service-processor', 'ssh', 'telnet']),
authentication_method=dict(required=True, type='str', authentication_method=dict(required=True, type='str',
choices=['community', 'password', choices=['community', 'password',
'publickey', 'domain', 'publickey', 'domain',
@ -199,6 +199,9 @@ class NetAppOntapUser(object):
# Error 16034 denotes a user not being found. # Error 16034 denotes a user not being found.
if to_native(error.code) == "16034": if to_native(error.code) == "16034":
return False return False
# Error 16043 denotes the user existing, but the application missing
elif to_native(error.code) == "16043":
return False
else: else:
self.module.fail_json(msg='Error getting user %s: %s' % (self.name, to_native(error)), self.module.fail_json(msg='Error getting user %s: %s' % (self.name, to_native(error)),
exception=traceback.format_exc()) exception=traceback.format_exc())
@ -293,6 +296,7 @@ class NetAppOntapUser(object):
else: else:
self.module.fail_json(msg='Error unlocking user %s: %s' % (self.name, to_native(error)), self.module.fail_json(msg='Error unlocking user %s: %s' % (self.name, to_native(error)),
exception=traceback.format_exc()) exception=traceback.format_exc())
return True
def delete_user(self): def delete_user(self):
user_delete = netapp_utils.zapi.NaElement.create_node_with_children( user_delete = netapp_utils.zapi.NaElement.create_node_with_children(