Minor change to excep handling for 4.0 (#53484)
This commit is contained in:
parent
e1c4ee2514
commit
de14cd7ae8
1 changed files with 1 additions and 1 deletions
|
@ -289,7 +289,7 @@ def main():
|
||||||
try:
|
try:
|
||||||
client['admin'].command('listDatabases', 1.0) # if this throws an error we need to authenticate
|
client['admin'].command('listDatabases', 1.0) # if this throws an error we need to authenticate
|
||||||
except Exception as excep:
|
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:
|
if login_user is not None and login_password is not None:
|
||||||
client.admin.authenticate(login_user, login_password, source=login_database)
|
client.admin.authenticate(login_user, login_password, source=login_database)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue