File tree Expand file tree Collapse file tree 2 files changed +17
-10
lines changed
Expand file tree Collapse file tree 2 files changed +17
-10
lines changed Original file line number Diff line number Diff line change 1717_logger : logging .Logger = logging .getLogger (__name__ )
1818
1919
20- class SSLMode (Enum ):
20+ class SupportedSSLMode (Enum ):
2121 VERIFY_CA : str = "verify-ca"
2222 VERIFY_FULL : str = "verify-full"
2323
24+ @staticmethod
25+ def default () -> str :
26+ return SupportedSSLMode .VERIFY_CA .value
27+
28+ @staticmethod
29+ def list () -> typing .List [str ]:
30+ return list (map (lambda mode : mode .value , SupportedSSLMode ))
31+
2432
2533def dynamic_plugin_import (name : str ):
2634 components = name .split ("." )
@@ -83,12 +91,15 @@ def set_iam_properties(
8391 # Make sure that is set to SSL level VERIFY_CA or higher.
8492 info .ssl = ssl
8593 if info .ssl is True :
86- if sslmode == SSLMode .VERIFY_CA .value :
87- info .sslmode = SSLMode .VERIFY_CA .value
88- elif sslmode == SSLMode .VERIFY_FULL .value :
89- info .sslmode = SSLMode .VERIFY_FULL .value
94+ if sslmode not in SupportedSSLMode .list ():
95+ info .sslmode = SupportedSSLMode .default ()
96+ _logger .debug (
97+ "A non-supported value: {} was provides for sslmode. Falling back to default value: {}" .format (
98+ sslmode , SupportedSSLMode .default ()
99+ )
100+ )
90101 else :
91- info .sslmode = SSLMode . VERIFY_CA . value
102+ info .sslmode = sslmode
92103 else :
93104 info .sslmode = ""
94105
Original file line number Diff line number Diff line change 11import typing
2- from typing import TYPE_CHECKING
32
43from redshift_connector .config import DEFAULT_PROTOCOL_VERSION
54
6- if TYPE_CHECKING :
7- from redshift_connector .iam_helper import SSLMode
8-
95
106class RedshiftProperty :
117 iam : bool = False
You can’t perform that action at this time.
0 commit comments