Fix mongodb_user ssl_cert_reqs param (#2963) (#2965)

pull/18777/head
Lujeni 8 years ago committed by Matt Clay
parent ead83cd148
commit e226211c5b

@ -313,20 +313,24 @@ def main():
password = module.params['password'] password = module.params['password']
ssl = module.params['ssl'] ssl = module.params['ssl']
ssl_cert_reqs = None ssl_cert_reqs = None
if ssl:
ssl_cert_reqs = getattr(ssl_lib, module.params['ssl_cert_reqs'])
roles = module.params['roles'] or [] roles = module.params['roles'] or []
state = module.params['state'] state = module.params['state']
update_password = module.params['update_password'] update_password = module.params['update_password']
try: try:
connection_params = {
"host": login_host,
"port": int(login_port),
}
if replica_set: if replica_set:
client = MongoClient(login_host, int(login_port), connection_params["replicaset"] = replica_set
replicaset=replica_set, ssl=ssl,
ssl_cert_reqs=ssl_cert_reqs) if ssl:
else: connection_params["ssl"] = ssl
client = MongoClient(login_host, int(login_port), ssl=ssl, connection_params["ssl_cert_reqs"] = getattr(ssl_lib, module.params['ssl_cert_reqs'])
ssl_cert_reqs=ssl_cert_reqs)
client = MongoClient(**connection_params)
if login_user is None and login_password is None: if login_user is None and login_password is None:
mongocnf_creds = load_mongocnf() mongocnf_creds = load_mongocnf()

Loading…
Cancel
Save