1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Bug Fixes for ontap_user_role.py (#44223)

This commit is contained in:
Chris Archibald 2018-08-17 06:11:39 -07:00 committed by ansibot
parent d0a7147224
commit 6d97765688

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 user roles - Create or destroy user roles
@ -112,7 +112,7 @@ class NetAppOntapUserRole(object):
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")
else: else:
self.server = netapp_utils.setup_na_ontap_zapi(module=self.module, vserver=self.vserver) self.server = netapp_utils.setup_na_ontap_zapi(module=self.module)
def get_role(self): def get_role(self):
""" """
@ -142,6 +142,9 @@ class NetAppOntapUserRole(object):
# Error 16031 denotes a role not being found. # Error 16031 denotes a role not being found.
if to_native(e.code) == "16031": if to_native(e.code) == "16031":
return False return False
# Error 16039 denotes command directory not found.
elif to_native(e.code) == "16039":
return False
else: else:
self.module.fail_json(msg='Error getting role %s: %s' % (self.name, to_native(e)), self.module.fail_json(msg='Error getting role %s: %s' % (self.name, to_native(e)),
exception=traceback.format_exc()) exception=traceback.format_exc())
@ -181,7 +184,8 @@ class NetAppOntapUserRole(object):
def apply(self): def apply(self):
changed = False changed = False
netapp_utils.ems_log_event("na_ontap_user_role", self.server) vserver = netapp_utils.setup_na_ontap_zapi(module=self.module, vserver=self.vserver)
netapp_utils.ems_log_event("na_ontap_user_role", vserver)
role_exists = self.get_role() role_exists = self.get_role()
if role_exists: if role_exists:
if self.state == 'absent': if self.state == 'absent':