Skip to content

Commit 4034455

Browse files
authored
Fix SSL deactivation using catalog properties (#3012)
<!-- Thanks for opening a pull request! --> <!-- In the case this PR will resolve an issue, please replace ${GITHUB_ISSUE_ID} below with the actual Github issue id. --> Closes #2985 # Rationale for this change ## Are these changes tested? Yes ## Are there any user-facing changes? <!-- In the case of user-facing changes, please add the changelog label. -->
1 parent 8fe63dc commit 4034455

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

pyiceberg/catalog/rest/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ def _create_session(self) -> Session:
363363

364364
# Sets the client side and server side SSL cert verification, if provided as properties.
365365
if ssl_config := self.properties.get(SSL):
366-
if ssl_ca_bundle := ssl_config.get(CA_BUNDLE):
366+
if (ssl_ca_bundle := ssl_config.get(CA_BUNDLE)) is not None:
367367
session.verify = ssl_ca_bundle
368368
if ssl_client := ssl_config.get(CLIENT):
369369
if all(k in ssl_client for k in (CERT, KEY)):

tests/catalog/test_rest.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,6 +1643,19 @@ def test_update_namespace_properties_invalid_namespace(rest_mock: Mocker) -> Non
16431643
assert "Empty namespace identifier" in str(e.value)
16441644

16451645

1646+
def test_with_disabled_ssl_ca_bundle(rest_mock: Mocker) -> None:
1647+
# Given
1648+
catalog_properties = {
1649+
"uri": TEST_URI,
1650+
"token": TEST_TOKEN,
1651+
"ssl": {
1652+
"cabundle": False,
1653+
},
1654+
}
1655+
catalog = RestCatalog("rest", **catalog_properties) # type: ignore
1656+
assert catalog._session.verify is False
1657+
1658+
16461659
def test_request_session_with_ssl_ca_bundle(monkeypatch: pytest.MonkeyPatch) -> None:
16471660
# Given
16481661
catalog_properties = {

0 commit comments

Comments
 (0)