Skip to content

Commit 4d206b9

Browse files
committed
fix(auth, iam): log if boto3 version insufficient for cname
1 parent b2dde82 commit 4d206b9

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

redshift_connector/iam_helper.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def set_iam_properties(info: RedshiftProperty) -> RedshiftProperty:
114114

115115
if info.iam and info.is_cname:
116116
if IdpAuthHelper.get_pkg_version("boto3") < Version("1.26.157"):
117-
raise ModuleNotFoundError(
117+
_logger.debug(
118118
"boto3 >= 1.26.157 required for authentication with Amazon Redshift using custom domain name. "
119119
"Please upgrade the installed version of boto3 to use this functionality."
120120
)
@@ -440,7 +440,7 @@ def set_cluster_credentials(
440440
typing.Dict[str, typing.Union[str, datetime.datetime]],
441441
client.get_cluster_credentials_with_iam(**request_params),
442442
)
443-
except ClientError as e:
443+
except Exception as e:
444444
if info.is_cname:
445445
_logger.debug(
446446
"Failed to get_cluster_credentials_with_iam. Assuming cluster incorrectly classified as cname, retrying..."
@@ -484,7 +484,7 @@ def set_cluster_credentials(
484484
typing.Dict[str, typing.Union[str, datetime.datetime]],
485485
client.get_cluster_credentials(**request_params),
486486
)
487-
except ClientError as e:
487+
except Exception as e:
488488
if info.is_cname:
489489
_logger.debug(
490490
"Failed to get_cluster_credentials. Assuming cluster incorrectly classified as cname, retrying..."

test/manual/test_redshift_custom_domain.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"""
1414

1515

16-
# @pytest.mark.skip(reason="manual")
16+
@pytest.mark.skip(reason="manual")
1717
@pytest.mark.parametrize("sslmode", (SupportedSSLMode.VERIFY_CA, SupportedSSLMode.VERIFY_FULL))
1818
def test_native_connect(provisioned_cname_db_kwargs, sslmode):
1919
# this test requires aws default profile contains valid credentials that provide permissions for
@@ -40,7 +40,7 @@ def test_native_connect(provisioned_cname_db_kwargs, sslmode):
4040
pass
4141

4242

43-
# @pytest.mark.skip(reason="manual")
43+
@pytest.mark.skip(reason="manual")
4444
@pytest.mark.parametrize("sslmode", (SupportedSSLMode.VERIFY_CA, SupportedSSLMode.VERIFY_FULL))
4545
def test_iam_connect(provisioned_cname_db_kwargs, sslmode):
4646
# this test requires aws default profile contains valid credentials that provide permissions for
@@ -62,7 +62,7 @@ def test_idp_connect(okta_idp, provisioned_cname_db_kwargs):
6262
pass
6363

6464

65-
# @pytest.mark.skip(reason="manual")
65+
@pytest.mark.skip(reason="manual")
6666
def test_nlb_connect():
6767
args = {
6868
"iam": True,

test/unit/test_iam_helper.py

-1
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,6 @@ def test_get_cluster_credentials_api_type_will_use_correct_api(conn_params, prov
810810
(
811811
("1.17.110", {"iam": True, "ssl": True, "auth_profile": "SomeTestProfile", "cluster_identifier": "my_cluster"}),
812812
("1.17.100", {"iam": True, "ssl": True, "auth_profile": "SomeTestProfile", "cluster_identifier": "my_cluster"}),
813-
("1.26.156", {"iam": True, "host": "mycustom.domain.name"}),
814813
),
815814
)
816815
def test_set_iam_properties_raises_exception_when_insufficient_boto3_version(mocker, boto3_version, connection_args):

0 commit comments

Comments
 (0)