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

Implement AsyncOpenSearch() parameter ssl_assert_hostname #843

Merged

Conversation

merlinz01
Copy link
Contributor

Description

Implements the ssl_assert_hostname parameter for AsyncOpenSearch().

Issues Resolved

Closes #842

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

…disabling SSL hostname verification

Signed-off-by: merlinz01 <158784988+merlinz01@users.noreply.github.com>
Copy link

codecov bot commented Nov 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.92%. Comparing base (ba715b9) to head (227fbaa).
Report is 69 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #843      +/-   ##
==========================================
- Coverage   71.95%   70.92%   -1.04%     
==========================================
  Files          91      113      +22     
  Lines        8001     8900     +899     
==========================================
+ Hits         5757     6312     +555     
- Misses       2244     2588     +344     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: merlinz01 <158784988+merlinz01@users.noreply.github.com>
Copy link
Member

@dblock dblock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it's a fairly trivial change, but we want to make sure someone doesn't break this code in the future, so let's add a test, please?

Mention it somewhere in the user guide in this repo, too.

Signed-off-by: merlinz01 <158784988+merlinz01@users.noreply.github.com>
@dblock
Copy link
Member

dblock commented Nov 14, 2024

Fix DCO, rebase please?

Signed-off-by: merlinz01 <158784988+merlinz01@users.noreply.github.com>
@merlinz01 merlinz01 force-pushed the implement-async-ssl_assert_hostname branch from 4552db2 to 7752471 Compare November 14, 2024 19:21
Signed-off-by: merlinz01 <158784988+merlinz01@users.noreply.github.com>
@merlinz01 merlinz01 requested a review from dblock November 14, 2024 19:59
Signed-off-by: Daniel (dB.) Doubrovkine <dblock@amazon.com>
@dblock
Copy link
Member

dblock commented Nov 14, 2024

CI failed in lint, nox -rs format I think ...

Signed-off-by: merlinz01 <158784988+merlinz01@users.noreply.github.com>
Copy link
Member

@dblock dblock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a legit test failure with a newer Python version?

_ TestAIOHttpConnection.test_nowarn_when_test_uses_https_if_verify_certs_is_off _
self = <test_opensearchpy.test_async.test_connection.TestAIOHttpConnection object at 0x7f8f401a8740>
    async def test_nowarn_when_test_uses_https_if_verify_certs_is_off(self) -> None:
        with warnings.catch_warnings(record=True) as w:
            con = AIOHttpConnection(
                use_ssl=True, verify_certs=False, ssl_show_warn=False
            )
            await con._create_aiohttp_session()
>           assert w == []
E           assert [<warnings.WarningMessage object at 0x7f8f304f7ef0>] == []
E             
E             Left contains one more item: <warnings.WarningMessage object at 0x7f8f304f7ef0>
E             
E             Full diff:
E             - []
E             + [
E             +     <warnings.WarningMessage object at 0x7f8f304f7ef0>,
E             + ]
test_opensearchpy/test_async/test_connection.py:231: AssertionError

@merlinz01
Copy link
Contributor Author

Testing with Python 3.12 works for me, can you rerun the test?

@dblock
Copy link
Member

dblock commented Nov 15, 2024

Testing with Python 3.12 works for me, can you rerun the test?

Failed again, it's not a fluke, there's some warning but the contents don't show up in the log (maybe start there to see the error) https://github.com/opensearch-project/opensearch-py/actions/runs/11846183040/job/33061554546?pr=843.

@merlinz01
Copy link
Contributor Author

enable_cleanup_closed ignored because https://github.com/python/cpython/pull/118960 is fixed in Python version sys.version_info(major=3, minor=12, micro=7, releaselevel='final', serial=0)

python/cpython#118960

@merlinz01
Copy link
Contributor Author

OK, so it's a deprecated parameter on aiohttp.TCPConnection starting in Python 3.12.7, I don't think related to these changes. Shall I add a patch for the test onto this PR?

@dblock
Copy link
Member

dblock commented Nov 15, 2024

OK, so it's a deprecated parameter on aiohttp.TCPConnection starting in Python 3.12.7, I don't think related to these changes. Shall I add a patch for the test onto this PR?

Yes please, we do want tests to pass :)

Signed-off-by: merlinz01 <158784988+merlinz01@users.noreply.github.com>
Signed-off-by: merlinz01 <158784988+merlinz01@users.noreply.github.com>
@merlinz01 merlinz01 requested a review from dblock November 16, 2024 02:14
@dblock dblock merged commit 12c379d into opensearch-project:main Nov 16, 2024
33 of 34 checks passed
@merlinz01 merlinz01 deleted the implement-async-ssl_assert_hostname branch November 16, 2024 13:36
@merlinz01
Copy link
Contributor Author

Thanks @dblock! I don't see where the release schedule for clients is documented, so wondering when this change will be available.

@dblock
Copy link
Member

dblock commented Nov 16, 2024

Open an issue to release v. next and I can try to make it happen this coming week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Async client is missing ssl_assert_hostname implementation
2 participants