Skip to content

Commit

Permalink
Merge "config/cassandra: ssl_context not supported on cassandra-drive…
Browse files Browse the repository at this point in the history
…r < 3.17"
  • Loading branch information
Jenkins CI authored and opencontrail-ci-admin committed Sep 10, 2020
2 parents e472362 + a451a45 commit 87f12c7
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/config/common/cfgm_common/datastore/drivers/cassandra_cql.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,13 +317,16 @@ def _Init_Cluster(self):
password=self.options.credential.get('password'))

# SSL related options
ssl_options, ssl_context = None, None
ssl_options = None
if self.options.ssl_enabled:
ssl_context = ssl.SSLContext(SSL_VERSION)
ssl_context.load_verify_locations(self.options.ca_certs)
ssl_context.verify_mode = ssl.CERT_REQUIRED
ssl_context.check_hostname = False
ssl_options = {}
# TODO(sahid): Future versions (>= 3.17) will support
# ssl_context.
ssl_options = {
"ssl_version": SSL_VERSION,
"ca_certs": self.options.ca_certs,
"check_hostname": False,
"cert_reqs": ssl.CERT_REQUIRED,
}

# Profiles related features
ExecutionProfile = connector.cluster.ExecutionProfile
Expand All @@ -349,7 +352,6 @@ def _Init_Cluster(self):
self._cluster = connector.cluster.Cluster(
endpoints,
ssl_options=ssl_options,
ssl_context=ssl_context,
auth_provider=auth_provider,
execution_profiles=profiles,
cql_version=self.CqlVersion)
Expand Down

0 comments on commit 87f12c7

Please sign in to comment.