@@ -135,14 +135,23 @@ def _get_startup_data(self):
135
135
'ignored' : host_distances_counter [HostDistance .IGNORED ]
136
136
}
137
137
138
- compression_type = cc ._connection ._compression_type if cc ._connection else 'NONE'
138
+ try :
139
+ compression_type = cc ._connection ._compression_type
140
+ except AttributeError :
141
+ compression_type = 'NONE'
139
142
140
- if self ._session .cluster .ssl_context :
141
- cert_validation = self ._session .cluster .ssl_context .verify_mode == ssl .CERT_REQUIRED
142
- elif self ._session .cluster .ssl_options :
143
- cert_validation = self ._session .cluster .ssl_options .get ('cert_reqs' ) == ssl .CERT_REQUIRED
144
- else :
145
- cert_validation = None
143
+ cert_validation = None
144
+ try :
145
+ if self ._session .cluster .ssl_context :
146
+ if isinstance (self ._session .cluster .ssl_context , ssl .SSLContext ):
147
+ cert_validation = self ._session .cluster .ssl_context .verify_mode == ssl .CERT_REQUIRED
148
+ else : # pyopenssl
149
+ from OpenSSL import SSL
150
+ cert_validation = self ._session .cluster .ssl_context .get_verify_mode () != SSL .VERIFY_NONE
151
+ elif self ._session .cluster .ssl_options :
152
+ cert_validation = self ._session .cluster .ssl_options .get ('cert_reqs' ) == ssl .CERT_REQUIRED
153
+ except Exception as e :
154
+ log .debug ('Unable to get the cert validation: {}' .format (e ))
146
155
147
156
uname_info = platform .uname ()
148
157
@@ -157,7 +166,7 @@ def _get_startup_data(self):
157
166
},
158
167
},
159
168
'data' : {
160
- 'driverName' : 'DataStax Enterprise Python Driver' ,
169
+ 'driverName' : 'DataStax Python Driver' ,
161
170
'driverVersion' : sys .modules ['cassandra' ].__version__ ,
162
171
'clientId' : str (self ._session .cluster .client_id ),
163
172
'sessionId' : str (self ._session .session_id ),
0 commit comments