-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix mongo connections #63053
Fix mongo connections #63053
Conversation
@@ -178,17 +178,15 @@ def _get_conn(ret): | |||
mdb = conn.get_database() | |||
else: | |||
if PYMONGO_VERSION > _LooseVersion("2.3"): | |||
conn = pymongo.MongoClient(host, port) | |||
conn = pymongo.MongoClient(host, port, username=user, password=password) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the username and password for the above client declarations? Line 177 here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, otherwise pymongo throws the following exception:
pymongo.errors.OperationFailure: command insert requires authentication, full error: {'ok': 0.0, 'errmsg': 'command insert requires authentication', 'code': 13, 'codeName': 'Unauthorized'}
Hi @genaumann, and thanks for the contribution. If you want, we have a few ways for you to learn how to write tests for salt. There is also some concise documentation on the process here. Otherwise, we will have to wait for someone else to pick up the tests here, which can take a lot of time. |
Hi @MKLeb, I tried my best to write a testcase for returner and ext_pillar. |
@genaumann we should probably add a test where we don't expect it to fail. This link will help you fix your pre-commit test https://pre-commit.com/. |
@cmcmarrow pre-commit pipeline doesn’t fail anymore |
re-run pr-centos-7-x86_64-py3-tcp-pytest |
Congratulations on your first PR being merged! 🎉 |
What does this PR do?
What issues does this PR fix or reference?
Add:
Fix:
Previous Behavior
Mongo ext_pillar was not useable, because the pymongo authenticate function is deprecated.
New Behavior
Now you are able to connect to mongo with uri. And the mongo ext_pillar module is usable.
Merge requirements satisfied?
[NOTICE] Bug fixes or features added to Salt require tests.
Don't know how to write tests for salt - sorry 👎
Commits signed with GPG?
No