Minor change to excep handling for 4.0 (#53484)

pull/55101/head
Rhys Campbell 6 years ago committed by ansibot
parent e1c4ee2514
commit de14cd7ae8

@ -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…
Cancel
Save