diff options
author | Lujeni <julien@thebault.co> | 2016-09-20 16:19:53 +0200 |
---|---|---|
committer | Adrian Likins <alikins@redhat.com> | 2016-09-20 10:19:53 -0400 |
commit | bbe7f73f89d2b5a2cc26fa1c08b5a7c76de75ca8 (patch) | |
tree | b0f2c4c7192545ba5c6fb0b89635564409466983 /database | |
parent | db7a3f48e10772bf96d422f2836fff5f1b0c751f (diff) | |
download | ansible-modules-extras-bbe7f73f89d2b5a2cc26fa1c08b5a7c76de75ca8.tar.gz |
Improve mongodb_user exception (#2962)
- Better error message
Diffstat (limited to 'database')
-rw-r--r-- | database/misc/mongodb_user.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/database/misc/mongodb_user.py b/database/misc/mongodb_user.py index 78d71956..551b5650 100644 --- a/database/misc/mongodb_user.py +++ b/database/misc/mongodb_user.py @@ -350,7 +350,7 @@ 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 ConnectionFailure, e: + except Exception, e: module.fail_json(msg='unable to connect to database: %s' % str(e)) check_compatibility(module, client) @@ -370,7 +370,7 @@ def main(): module.exit_json(changed=True, user=user) user_add(module, client, db_name, user, password, roles) - except OperationFailure, e: + except Exception, e: 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 @@ -381,7 +381,7 @@ def main(): elif state == 'absent': try: user_remove(module, client, db_name, user) - except OperationFailure, e: + except Exception, e: module.fail_json(msg='Unable to remove user: %s' % str(e)) module.exit_json(changed=True, user=user) |