Skip to content
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 use of SSLContext with sniffing #199

Merged
merged 5 commits into from
Jan 6, 2025

Conversation

pquentin
Copy link
Member

@pquentin pquentin commented Jan 6, 2025

Closes elastic/elasticsearch-py#2731

When sniffing is enabled, warn_if_varying_node_config_options checks if all node configs use the same options besides host, port, and a few others. This is done using dataclasses.asdict, which will try to use the same mechanism as pickling to convert SSLContext objects to a dictionary. However, SSLContext objects cannot be pickled, and there's no good way to check that they are identical.

Instead, we choose to ignore ssl_context. We also have to stop using asdict() because it converts all keys, even those we don't need. Instead, we use the shallow copy workaround from the docs: https://docs.python.org/3/library/dataclasses.html#dataclasses.asdict.

It's not triggered for normal code.
@pquentin pquentin merged commit af34992 into elastic:main Jan 6, 2025
11 checks passed
github-actions bot pushed a commit that referenced this pull request Jan 6, 2025
* Fix use of SSLContext with sniffing

* Fix lint

* Ignore enabled_cleanup_closed warning

It's not triggered for normal code.

* Remove warning filter

(cherry picked from commit af34992)
github-actions bot pushed a commit that referenced this pull request Jan 6, 2025
* Fix use of SSLContext with sniffing

* Fix lint

* Ignore enabled_cleanup_closed warning

It's not triggered for normal code.

* Remove warning filter

(cherry picked from commit af34992)
pquentin pushed a commit that referenced this pull request Jan 6, 2025
pquentin pushed a commit that referenced this pull request Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants