From dbfebdc1f72a6c0f10c3f91d7a97c20c094fb661 Mon Sep 17 00:00:00 2001 From: Rhys Campbell Date: Thu, 7 Mar 2019 21:42:02 +0100 Subject: [PATCH] Minor change to excep handling for 4.0 --- lib/ansible/modules/database/mongodb/mongodb_shard.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/modules/database/mongodb/mongodb_shard.py b/lib/ansible/modules/database/mongodb/mongodb_shard.py index 0a7973d3a447df..8dc67b1690a8bd 100644 --- a/lib/ansible/modules/database/mongodb/mongodb_shard.py +++ b/lib/ansible/modules/database/mongodb/mongodb_shard.py @@ -289,7 +289,7 @@ def main(): try: client['admin'].command('listDatabases', 1.0) # if this throws an error we need to authenticate except Exception as excep: - if "not authorized on" in str(excep): + if "not authorized on" in str(excep) or "command listDatabases requires authentication" in str(excep): if login_user is not None and login_password is not None: client.admin.authenticate(login_user, login_password, source=login_database) else: