Skip to content

Commit

Permalink
Merge pull request #1079 from datastax/python-1238
Browse files Browse the repository at this point in the history
PYTHON-1238: Fix cloud connection issue with recent OpenSSL versions
  • Loading branch information
aboudreault committed May 13, 2020
2 parents 105bea9 + d6a5e4d commit 88a8635
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 23 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
3.24.0
======
Not released

Bug Fixes
---------
* Unable to connect to a cloud cluster using Ubuntu 20.04 (PYTHON-1238)

3.23.0
======
April 6, 2020
Expand Down
38 changes: 17 additions & 21 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def initializeEnvironment() {
pip install nose-ignore-docstring nose-exclude service_identity
'''

if (params.CYTHON) {
if (env.CYTHON_ENABLED == 'True') {
sh label: 'Install cython modules', script: '''#!/bin/bash -lex
pip install cython numpy
'''
Expand All @@ -71,7 +71,7 @@ def initializeEnvironment() {
}

def installDriverAndCompileExtensions() {
if (params.CYTHON) {
if (env.CYTHON_ENABLED == 'True') {
sh label: 'Install the driver and compile with C extensions with Cython', script: '''#!/bin/bash -lex
python setup.py build_ext --inplace
'''
Expand All @@ -87,7 +87,7 @@ def executeStandardTests() {
* Run the cython unit tests, this is not done in travis because it takes too much time for the
* whole matrix to build with cython
*/
if (params.CYTHON) {
if (env.CYTHON_ENABLED == 'True') {
sh label: 'Execute Cython unit tests', script: '''#!/bin/bash -lex
# Load CCM environment variables
set -o allexport
Expand All @@ -107,7 +107,7 @@ def executeStandardTests() {
set +o allexport
SIMULACRON_JAR="${HOME}/simulacron.jar"
#SIMULACRON_JAR=${SIMULACRON_JAR} EVENT_LOOP_MANAGER=${EVENT_LOOP_MANAGER} CASSANDRA_DIR=${CCM_INSTALL_DIR} CCM_ARGS="${CCM_ARGS}" DSE_VERSION=${DSE_VERSION} CASSANDRA_VERSION=${CCM_CASSANDRA_VERSION} MAPPED_CASSANDRA_VERSION=${MAPPED_CASSANDRA_VERSION} VERIFY_CYTHON=${CYTHON_ENABLED} nosetests -s -v --logging-format="[%(levelname)s] %(asctime)s %(thread)d: %(message)s" --with-ignore-docstrings --with-xunit --xunit-file=simulacron_results.xml tests/integration/simulacron/ || true
SIMULACRON_JAR=${SIMULACRON_JAR} EVENT_LOOP_MANAGER=${EVENT_LOOP_MANAGER} CASSANDRA_DIR=${CCM_INSTALL_DIR} CCM_ARGS="${CCM_ARGS}" DSE_VERSION=${DSE_VERSION} CASSANDRA_VERSION=${CCM_CASSANDRA_VERSION} MAPPED_CASSANDRA_VERSION=${MAPPED_CASSANDRA_VERSION} VERIFY_CYTHON=${CYTHON_ENABLED} nosetests -s -v --logging-format="[%(levelname)s] %(asctime)s %(thread)d: %(message)s" --with-ignore-docstrings --with-xunit --xunit-file=simulacron_results.xml tests/integration/simulacron/ || true
'''

sh label: 'Execute CQL engine integration tests', script: '''#!/bin/bash -lex
Expand All @@ -116,7 +116,7 @@ def executeStandardTests() {
. ${HOME}/environment.txt
set +o allexport
#EVENT_LOOP_MANAGER=${EVENT_LOOP_MANAGER} CCM_ARGS="${CCM_ARGS}" DSE_VERSION=${DSE_VERSION} CASSANDRA_VERSION=${CCM_CASSANDRA_VERSION} MAPPED_CASSANDRA_VERSION=${MAPPED_CASSANDRA_VERSION} VERIFY_CYTHON=${CYTHON_ENABLED} nosetests -s -v --logging-format="[%(levelname)s] %(asctime)s %(thread)d: %(message)s" --with-ignore-docstrings --with-xunit --xunit-file=cqle_results.xml tests/integration/cqlengine/ || true
EVENT_LOOP_MANAGER=${EVENT_LOOP_MANAGER} CCM_ARGS="${CCM_ARGS}" DSE_VERSION=${DSE_VERSION} CASSANDRA_VERSION=${CCM_CASSANDRA_VERSION} MAPPED_CASSANDRA_VERSION=${MAPPED_CASSANDRA_VERSION} VERIFY_CYTHON=${CYTHON_ENABLED} nosetests -s -v --logging-format="[%(levelname)s] %(asctime)s %(thread)d: %(message)s" --with-ignore-docstrings --with-xunit --xunit-file=cqle_results.xml tests/integration/cqlengine/ || true
'''

sh label: 'Execute Apache CassandraⓇ integration tests', script: '''#!/bin/bash -lex
Expand All @@ -125,7 +125,7 @@ def executeStandardTests() {
. ${HOME}/environment.txt
set +o allexport
#EVENT_LOOP_MANAGER=${EVENT_LOOP_MANAGER} CCM_ARGS="${CCM_ARGS}" DSE_VERSION=${DSE_VERSION} CASSANDRA_VERSION=${CCM_CASSANDRA_VERSION} MAPPED_CASSANDRA_VERSION=${MAPPED_CASSANDRA_VERSION} VERIFY_CYTHON=${CYTHON_ENABLED} nosetests -s -v --logging-format="[%(levelname)s] %(asctime)s %(thread)d: %(message)s" --with-ignore-docstrings --with-xunit --xunit-file=standard_results.xml tests/integration/standard/test_cluster.py || true
EVENT_LOOP_MANAGER=${EVENT_LOOP_MANAGER} CCM_ARGS="${CCM_ARGS}" DSE_VERSION=${DSE_VERSION} CASSANDRA_VERSION=${CCM_CASSANDRA_VERSION} MAPPED_CASSANDRA_VERSION=${MAPPED_CASSANDRA_VERSION} VERIFY_CYTHON=${CYTHON_ENABLED} nosetests -s -v --logging-format="[%(levelname)s] %(asctime)s %(thread)d: %(message)s" --with-ignore-docstrings --with-xunit --xunit-file=standard_results.xml tests/integration/standard/ || true
'''

if (env.CASSANDRA_VERSION.split('-')[0] == 'dse' && env.CASSANDRA_VERSION.split('-')[1] != '4.8') {
Expand All @@ -135,7 +135,7 @@ def executeStandardTests() {
. ${HOME}/environment.txt
set +o allexport
#EVENT_LOOP_MANAGER=${EVENT_LOOP_MANAGER} CASSANDRA_DIR=${CCM_INSTALL_DIR} DSE_VERSION=${DSE_VERSION} ADS_HOME="${HOME}/" VERIFY_CYTHON=${CYTHON_ENABLED} nosetests -s -v --logging-format="[%(levelname)s] %(asctime)s %(thread)d: %(message)s" --with-ignore-docstrings --with-xunit --xunit-file=dse_results.xml tests/integration/advanced/ || true
EVENT_LOOP_MANAGER=${EVENT_LOOP_MANAGER} CASSANDRA_DIR=${CCM_INSTALL_DIR} DSE_VERSION=${DSE_VERSION} ADS_HOME="${HOME}/" VERIFY_CYTHON=${CYTHON_ENABLED} nosetests -s -v --logging-format="[%(levelname)s] %(asctime)s %(thread)d: %(message)s" --with-ignore-docstrings --with-xunit --xunit-file=dse_results.xml tests/integration/advanced/ || true
'''
}

Expand All @@ -145,7 +145,7 @@ def executeStandardTests() {
. ${HOME}/environment.txt
set +o allexport
#EVENT_LOOP_MANAGER=${EVENT_LOOP_MANAGER} CLOUD_PROXY_PATH="${HOME}/proxy/" CASSANDRA_VERSION=${CCM_CASSANDRA_VERSION} MAPPED_CASSANDRA_VERSION=${MAPPED_CASSANDRA_VERSION} VERIFY_CYTHON=${CYTHON_ENABLED} nosetests -s -v --logging-format="[%(levelname)s] %(asctime)s %(thread)d: %(message)s" --with-ignore-docstrings --with-xunit --xunit-file=advanced_results.xml tests/integration/cloud/ || true
EVENT_LOOP_MANAGER=${EVENT_LOOP_MANAGER} CLOUD_PROXY_PATH="${HOME}/proxy/" CASSANDRA_VERSION=${CCM_CASSANDRA_VERSION} MAPPED_CASSANDRA_VERSION=${MAPPED_CASSANDRA_VERSION} VERIFY_CYTHON=${CYTHON_ENABLED} nosetests -s -v --logging-format="[%(levelname)s] %(asctime)s %(thread)d: %(message)s" --with-ignore-docstrings --with-xunit --xunit-file=advanced_results.xml tests/integration/cloud/ || true
'''

if (env.EXECUTE_LONG_TESTS == 'True') {
Expand All @@ -155,7 +155,7 @@ def executeStandardTests() {
. ${HOME}/environment.txt
set +o allexport
#EVENT_LOOP_MANAGER=${EVENT_LOOP_MANAGER} CCM_ARGS="${CCM_ARGS}" DSE_VERSION=${DSE_VERSION} CASSANDRA_VERSION=${CCM_CASSANDRA_VERSION} MAPPED_CASSANDRA_VERSION=${MAPPED_CASSANDRA_VERSION} VERIFY_CYTHON=${CYTHON_ENABLED} nosetests -s -v --logging-format="[%(levelname)s] %(asctime)s %(thread)d: %(message)s" --exclude-dir=tests/integration/long/upgrade --with-ignore-docstrings --with-xunit --xunit-file=long_results.xml tests/integration/long/ || true
EVENT_LOOP_MANAGER=${EVENT_LOOP_MANAGER} CCM_ARGS="${CCM_ARGS}" DSE_VERSION=${DSE_VERSION} CASSANDRA_VERSION=${CCM_CASSANDRA_VERSION} MAPPED_CASSANDRA_VERSION=${MAPPED_CASSANDRA_VERSION} VERIFY_CYTHON=${CYTHON_ENABLED} nosetests -s -v --logging-format="[%(levelname)s] %(asctime)s %(thread)d: %(message)s" --exclude-dir=tests/integration/long/upgrade --with-ignore-docstrings --with-xunit --xunit-file=long_results.xml tests/integration/long/ || true
'''
}
}
Expand Down Expand Up @@ -291,7 +291,7 @@ def describeScheduledTestingStage() {
script {
def type = params.CI_SCHEDULE.toLowerCase().capitalize()
def displayName = "${type} schedule (${env.EVENT_LOOP_MANAGER}"
if (params.CYTHON) {
if (env.CYTHON_ENABLED == 'True') {
displayName += " | Cython"
}
if (params.PROFILE != 'NONE') {
Expand All @@ -303,7 +303,7 @@ def describeScheduledTestingStage() {
def serverVersionDescription = "${params.CI_SCHEDULE_SERVER_VERSION.replaceAll(' ', ', ')} server version(s) in the matrix"
def pythonVersionDescription = "${params.CI_SCHEDULE_PYTHON_VERSION.replaceAll(' ', ', ')} Python version(s) in the matrix"
def description = "${type} scheduled testing using ${env.EVENT_LOOP_MANAGER} event loop manager"
if (params.CYTHON) {
if (env.CYTHON_ENABLED == 'True') {
description += ", with Cython enabled"
}
if (params.PROFILE != 'NONE') {
Expand Down Expand Up @@ -333,7 +333,7 @@ def describeAdhocTestingStage() {
}
}
def displayName = "${params.ADHOC_BUILD_AND_EXECUTE_TESTS_SERVER_VERSION} for v${params.ADHOC_BUILD_AND_EXECUTE_TESTS_PYTHON_VERSION} (${env.EVENT_LOOP_MANAGER}"
if (params.CYTHON) {
if (env.CYTHON_ENABLED == 'True') {
displayName += " | Cython"
}
if (params.PROFILE != 'NONE') {
Expand All @@ -343,7 +343,7 @@ def describeAdhocTestingStage() {
currentBuild.displayName = displayName

def description = "Testing ${serverDisplayName} ${serverVersion} using ${env.EVENT_LOOP_MANAGER} against Python ${params.ADHOC_BUILD_AND_EXECUTE_TESTS_PYTHON_VERSION}"
if (params.CYTHON) {
if (env.CYTHON_ENABLED == 'True') {
description += ", with Cython"
}
if (params.PROFILE == 'NONE') {
Expand Down Expand Up @@ -409,8 +409,7 @@ pipeline {
'dse-5.1', // Legacy DataStax Enterprise
'dse-6.0', // Previous DataStax Enterprise
'dse-6.7', // Previous DataStax Enterprise
'dse-6.8.0', // Current DataStax Enterprise
'dse-6.8', // Development DataStax Enterprise
'dse-6.8', // Current DataStax Enterprise
'ALL'],
description: '''Apache CassandraⓇ and DataStax Enterprise server version to use for adhoc <b>BUILD-AND-EXECUTE-TESTS</b> <strong>ONLY!</strong>
<table style="width:100%">
Expand Down Expand Up @@ -456,10 +455,6 @@ pipeline {
<td><strong>dse-6.7</strong></td>
<td>DataStax Enterprise v6.7.x</td>
</tr>
<tr>
<td><strong>dse-6.8.0</strong></td>
<td>DataStax Enterprise v6.8.0</td>
</tr>
<tr>
<td><strong>dse-6.8</strong></td>
<td>DataStax Enterprise v6.8.x (<b>CURRENTLY UNDER DEVELOPMENT</b>)</td>
Expand Down Expand Up @@ -600,6 +595,7 @@ pipeline {
EVENT_LOOP_MANAGER = "${params.EVENT_LOOP_MANAGER.toLowerCase()}"
EXECUTE_LONG_TESTS = "${params.EXECUTE_LONG_TESTS ? 'True' : 'False'}"
CCM_ENVIRONMENT_SHELL = '/usr/local/bin/ccm_environment.sh'
CCM_MAX_HEAP_SIZE = '1024M'
}

stages {
Expand All @@ -609,7 +605,7 @@ pipeline {
}
when {
beforeAgent true
branch pattern: '((dev|long)-)+python.*', comparator: 'REGEXP'
branch pattern: '((dev|long)-)?python-.*', comparator: 'REGEXP'
allOf {
expression { params.ADHOC_BUILD_TYPE == 'BUILD' }
expression { params.CI_SCHEDULE == 'DO-NOT-CHANGE-THIS-SELECTION' }
Expand All @@ -630,7 +626,7 @@ pipeline {
}
axis {
name 'CYTHON_ENABLED'
values 'False'
values 'False', 'True'
}
}

Expand Down
4 changes: 2 additions & 2 deletions cassandra/datastax/cloud/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

_HAS_SSL = True
try:
from ssl import SSLContext, PROTOCOL_TLSv1, CERT_REQUIRED
from ssl import SSLContext, PROTOCOL_TLS, CERT_REQUIRED
except:
_HAS_SSL = False

Expand Down Expand Up @@ -169,7 +169,7 @@ def parse_metadata_info(config, http_data):


def _ssl_context_from_cert(ca_cert_location, cert_location, key_location):
ssl_context = SSLContext(PROTOCOL_TLSv1)
ssl_context = SSLContext(PROTOCOL_TLS)
ssl_context.load_verify_locations(ca_cert_location)
ssl_context.verify_mode = CERT_REQUIRED
ssl_context.load_cert_chain(certfile=cert_location, keyfile=key_location)
Expand Down

0 comments on commit 88a8635

Please sign in to comment.