From 5c35d55b3c4bf265e2328b6c80da5ac0b6be8c33 Mon Sep 17 00:00:00 2001 From: gyurco Date: Wed, 20 Jul 2016 07:58:35 +0200 Subject: [PATCH] mongodb_user: fix ssl_cert_reqs exception (#2573) If ssl is not enabled, but ssl_cert_reqs is passed to pymongo, an exception occures. Fixes: #2571 --- lib/ansible/modules/extras/database/misc/mongodb_user.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/extras/database/misc/mongodb_user.py b/lib/ansible/modules/extras/database/misc/mongodb_user.py index fbec2e3452c..f4a4cc46bd5 100644 --- a/lib/ansible/modules/extras/database/misc/mongodb_user.py +++ b/lib/ansible/modules/extras/database/misc/mongodb_user.py @@ -299,7 +299,9 @@ def main(): user = module.params['name'] password = module.params['password'] ssl = module.params['ssl'] - ssl_cert_reqs = getattr(ssl_lib, module.params['ssl_cert_reqs']) + ssl_cert_reqs = None + if ssl: + ssl_cert_reqs = getattr(ssl_lib, module.params['ssl_cert_reqs']) roles = module.params['roles'] state = module.params['state'] update_password = module.params['update_password']