mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 11:51:26 -07:00
Make mongodb modules compile on python 3
This commit is contained in:
parent
1bca0847a4
commit
6963cd8ae7
3 changed files with 14 additions and 8 deletions
|
@ -364,7 +364,8 @@ def main():
|
|||
module.fail_json(msg='The localhost login exception only allows the first admin account to be created')
|
||||
#else: this has to be the first admin user added
|
||||
|
||||
except Exception, e:
|
||||
except Exception:
|
||||
e = get_exception()
|
||||
module.fail_json(msg='unable to connect to database: %s' % str(e))
|
||||
|
||||
if state == 'present':
|
||||
|
@ -382,7 +383,8 @@ def main():
|
|||
module.exit_json(changed=True, user=user)
|
||||
|
||||
user_add(module, client, db_name, user, password, roles)
|
||||
except Exception, e:
|
||||
except Exception:
|
||||
e = get_exception()
|
||||
module.fail_json(msg='Unable to add or update user: %s' % str(e))
|
||||
|
||||
# Here we can check password change if mongo provide a query for that : https://jira.mongodb.org/browse/SERVER-22848
|
||||
|
@ -393,11 +395,13 @@ def main():
|
|||
elif state == 'absent':
|
||||
try:
|
||||
user_remove(module, client, db_name, user)
|
||||
except Exception, e:
|
||||
except Exception:
|
||||
e = get_exception()
|
||||
module.fail_json(msg='Unable to remove user: %s' % str(e))
|
||||
|
||||
module.exit_json(changed=True, user=user)
|
||||
|
||||
# import module snippets
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue