From 67b8f3eab9cc3e3035c246c83f03e0ee3974f982 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Tue, 18 Feb 2020 20:00:44 -0500 Subject: [PATCH] fix #691 for real --- mtools/mlaunch/mlaunch.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mtools/mlaunch/mlaunch.py b/mtools/mlaunch/mlaunch.py index 82c70ee8..654813d8 100755 --- a/mtools/mlaunch/mlaunch.py +++ b/mtools/mlaunch/mlaunch.py @@ -1693,6 +1693,11 @@ def _initiate_replset(self, port, name, maxwait=30): def _add_user(self, port, name, password, database, roles): con = self.client('localhost:%i' % port) + ismaster = con['admin'].command('isMaster') + set_name = ismaster.get('setName') + if set_name: + con.close() + con = self.client('localhost:%i'%port, replicaSet=set_name) v = con['admin'].command('isMaster').get('maxWireVersion', 0) if v >= 7: # Until drivers have implemented SCRAM-SHA-256, use old mechanism.