From 35880029480a944a73500e9fb7bf0a51bf154da4 Mon Sep 17 00:00:00 2001 From: PS-EGHornbostel Date: Thu, 27 Jun 2019 00:37:12 -0700 Subject: [PATCH] Allow Cassandra schema builder to use credentials (#1635) * Allow Cassandra schema builder to use credentials Currently the Cassandra schema builder job only works on open Cassandra installations. This PR fixes this by modifying the script so that two environmental variables, CASSANDRA_USER and CASSANDRA_PASSWORD, could be passed in to supply these credentials. Signed-off-by: E.G. Hornbostel * Fixed missing semi-colon Signed-off-by: E.G. Hornbostel --- plugin/storage/cassandra/schema/docker.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugin/storage/cassandra/schema/docker.sh b/plugin/storage/cassandra/schema/docker.sh index 1f7390d2f16..6dcb380f893 100755 --- a/plugin/storage/cassandra/schema/docker.sh +++ b/plugin/storage/cassandra/schema/docker.sh @@ -11,6 +11,8 @@ DATACENTER=${DATACENTER:-"dc1"} KEYSPACE=${KEYSPACE:-"jaeger_v1_${DATACENTER}"} MODE=${MODE:-"test"} TEMPLATE=${TEMPLATE:-""} +USER=${CASSANDRA_USERNAME:-""} +PASSWORD=${CASSANDRA_PASSWORD:-""} total_wait=0 while true @@ -31,4 +33,9 @@ done echo "Generating the schema for the keyspace ${KEYSPACE} and datacenter ${DATACENTER}" -MODE="${MODE}" DATACENTER="${DATACENTER}" KEYSPACE="${KEYSPACE}" /cassandra-schema/create.sh "${TEMPLATE}" | ${CQLSH} ${CQLSH_SSL} ${CQLSH_HOST} + +if [ -z "$PASSWORD" ]; then + MODE="${MODE}" DATACENTER="${DATACENTER}" KEYSPACE="${KEYSPACE}" /cassandra-schema/create.sh "${TEMPLATE}" | ${CQLSH} ${CQLSH_SSL} ${CQLSH_HOST} +else + MODE="${MODE}" DATACENTER="${DATACENTER}" KEYSPACE="${KEYSPACE}" /cassandra-schema/create.sh "${TEMPLATE}" | ${CQLSH} ${CQLSH_SSL} ${CQLSH_HOST} -u ${USER} -p ${PASSWORD} +fi