From ca81baf46cb4bc2f70b5a8e1ec9c7ffbc7b7a027 Mon Sep 17 00:00:00 2001 From: PSanetra Date: Thu, 2 Aug 2018 19:17:26 +0200 Subject: [PATCH 1/2] Accept 1 or true as value for INFLUXDB_HTTP_AUTH_ENABLED --- influxdb/1.5/alpine/init-influxdb.sh | 4 ++-- influxdb/1.5/data/alpine/init-influxdb.sh | 4 ++-- influxdb/1.5/data/init-influxdb.sh | 4 ++-- influxdb/1.5/init-influxdb.sh | 4 ++-- influxdb/1.6/alpine/init-influxdb.sh | 4 ++-- influxdb/1.6/data/alpine/init-influxdb.sh | 4 ++-- influxdb/1.6/data/init-influxdb.sh | 4 ++-- influxdb/1.6/init-influxdb.sh | 4 ++-- influxdb/circle-test.sh | 19 +++++++++++++++---- influxdb/nightly/alpine/init-influxdb.sh | 4 ++-- influxdb/nightly/init-influxdb.sh | 4 ++-- 11 files changed, 35 insertions(+), 24 deletions(-) diff --git a/influxdb/1.5/alpine/init-influxdb.sh b/influxdb/1.5/alpine/init-influxdb.sh index c2097ecd8..2ab2b6e54 100755 --- a/influxdb/1.5/alpine/init-influxdb.sh +++ b/influxdb/1.5/alpine/init-influxdb.sh @@ -4,9 +4,9 @@ set -e AUTH_ENABLED="$INFLUXDB_HTTP_AUTH_ENABLED" if [ -z "$AUTH_ENABLED" ]; then - AUTH_ENABLED="$(grep -iE '^\s*auth-enabled\s*=\s*true' /etc/influxdb/influxdb.conf | grep -io 'true' | cat)" + AUTH_ENABLED="$(grep -iE '^\s*auth-enabled\s*=\s*(true|1)' /etc/influxdb/influxdb.conf | grep -ioE '(true|1)' | cat)" else - AUTH_ENABLED="$(echo "$INFLUXDB_HTTP_AUTH_ENABLED" | grep -io 'true' | cat)" + AUTH_ENABLED="$(echo "$INFLUXDB_HTTP_AUTH_ENABLED" | grep -ioE '(true|1)' | cat)" fi INIT_USERS=$([ ! -z "$AUTH_ENABLED" ] && [ ! -z "$INFLUXDB_ADMIN_USER" ] && echo 1 || echo) diff --git a/influxdb/1.5/data/alpine/init-influxdb.sh b/influxdb/1.5/data/alpine/init-influxdb.sh index c2097ecd8..2ab2b6e54 100755 --- a/influxdb/1.5/data/alpine/init-influxdb.sh +++ b/influxdb/1.5/data/alpine/init-influxdb.sh @@ -4,9 +4,9 @@ set -e AUTH_ENABLED="$INFLUXDB_HTTP_AUTH_ENABLED" if [ -z "$AUTH_ENABLED" ]; then - AUTH_ENABLED="$(grep -iE '^\s*auth-enabled\s*=\s*true' /etc/influxdb/influxdb.conf | grep -io 'true' | cat)" + AUTH_ENABLED="$(grep -iE '^\s*auth-enabled\s*=\s*(true|1)' /etc/influxdb/influxdb.conf | grep -ioE '(true|1)' | cat)" else - AUTH_ENABLED="$(echo "$INFLUXDB_HTTP_AUTH_ENABLED" | grep -io 'true' | cat)" + AUTH_ENABLED="$(echo "$INFLUXDB_HTTP_AUTH_ENABLED" | grep -ioE '(true|1)' | cat)" fi INIT_USERS=$([ ! -z "$AUTH_ENABLED" ] && [ ! -z "$INFLUXDB_ADMIN_USER" ] && echo 1 || echo) diff --git a/influxdb/1.5/data/init-influxdb.sh b/influxdb/1.5/data/init-influxdb.sh index c2097ecd8..2ab2b6e54 100755 --- a/influxdb/1.5/data/init-influxdb.sh +++ b/influxdb/1.5/data/init-influxdb.sh @@ -4,9 +4,9 @@ set -e AUTH_ENABLED="$INFLUXDB_HTTP_AUTH_ENABLED" if [ -z "$AUTH_ENABLED" ]; then - AUTH_ENABLED="$(grep -iE '^\s*auth-enabled\s*=\s*true' /etc/influxdb/influxdb.conf | grep -io 'true' | cat)" + AUTH_ENABLED="$(grep -iE '^\s*auth-enabled\s*=\s*(true|1)' /etc/influxdb/influxdb.conf | grep -ioE '(true|1)' | cat)" else - AUTH_ENABLED="$(echo "$INFLUXDB_HTTP_AUTH_ENABLED" | grep -io 'true' | cat)" + AUTH_ENABLED="$(echo "$INFLUXDB_HTTP_AUTH_ENABLED" | grep -ioE '(true|1)' | cat)" fi INIT_USERS=$([ ! -z "$AUTH_ENABLED" ] && [ ! -z "$INFLUXDB_ADMIN_USER" ] && echo 1 || echo) diff --git a/influxdb/1.5/init-influxdb.sh b/influxdb/1.5/init-influxdb.sh index c2097ecd8..2ab2b6e54 100755 --- a/influxdb/1.5/init-influxdb.sh +++ b/influxdb/1.5/init-influxdb.sh @@ -4,9 +4,9 @@ set -e AUTH_ENABLED="$INFLUXDB_HTTP_AUTH_ENABLED" if [ -z "$AUTH_ENABLED" ]; then - AUTH_ENABLED="$(grep -iE '^\s*auth-enabled\s*=\s*true' /etc/influxdb/influxdb.conf | grep -io 'true' | cat)" + AUTH_ENABLED="$(grep -iE '^\s*auth-enabled\s*=\s*(true|1)' /etc/influxdb/influxdb.conf | grep -ioE '(true|1)' | cat)" else - AUTH_ENABLED="$(echo "$INFLUXDB_HTTP_AUTH_ENABLED" | grep -io 'true' | cat)" + AUTH_ENABLED="$(echo "$INFLUXDB_HTTP_AUTH_ENABLED" | grep -ioE '(true|1)' | cat)" fi INIT_USERS=$([ ! -z "$AUTH_ENABLED" ] && [ ! -z "$INFLUXDB_ADMIN_USER" ] && echo 1 || echo) diff --git a/influxdb/1.6/alpine/init-influxdb.sh b/influxdb/1.6/alpine/init-influxdb.sh index c2097ecd8..2ab2b6e54 100755 --- a/influxdb/1.6/alpine/init-influxdb.sh +++ b/influxdb/1.6/alpine/init-influxdb.sh @@ -4,9 +4,9 @@ set -e AUTH_ENABLED="$INFLUXDB_HTTP_AUTH_ENABLED" if [ -z "$AUTH_ENABLED" ]; then - AUTH_ENABLED="$(grep -iE '^\s*auth-enabled\s*=\s*true' /etc/influxdb/influxdb.conf | grep -io 'true' | cat)" + AUTH_ENABLED="$(grep -iE '^\s*auth-enabled\s*=\s*(true|1)' /etc/influxdb/influxdb.conf | grep -ioE '(true|1)' | cat)" else - AUTH_ENABLED="$(echo "$INFLUXDB_HTTP_AUTH_ENABLED" | grep -io 'true' | cat)" + AUTH_ENABLED="$(echo "$INFLUXDB_HTTP_AUTH_ENABLED" | grep -ioE '(true|1)' | cat)" fi INIT_USERS=$([ ! -z "$AUTH_ENABLED" ] && [ ! -z "$INFLUXDB_ADMIN_USER" ] && echo 1 || echo) diff --git a/influxdb/1.6/data/alpine/init-influxdb.sh b/influxdb/1.6/data/alpine/init-influxdb.sh index c2097ecd8..2ab2b6e54 100755 --- a/influxdb/1.6/data/alpine/init-influxdb.sh +++ b/influxdb/1.6/data/alpine/init-influxdb.sh @@ -4,9 +4,9 @@ set -e AUTH_ENABLED="$INFLUXDB_HTTP_AUTH_ENABLED" if [ -z "$AUTH_ENABLED" ]; then - AUTH_ENABLED="$(grep -iE '^\s*auth-enabled\s*=\s*true' /etc/influxdb/influxdb.conf | grep -io 'true' | cat)" + AUTH_ENABLED="$(grep -iE '^\s*auth-enabled\s*=\s*(true|1)' /etc/influxdb/influxdb.conf | grep -ioE '(true|1)' | cat)" else - AUTH_ENABLED="$(echo "$INFLUXDB_HTTP_AUTH_ENABLED" | grep -io 'true' | cat)" + AUTH_ENABLED="$(echo "$INFLUXDB_HTTP_AUTH_ENABLED" | grep -ioE '(true|1)' | cat)" fi INIT_USERS=$([ ! -z "$AUTH_ENABLED" ] && [ ! -z "$INFLUXDB_ADMIN_USER" ] && echo 1 || echo) diff --git a/influxdb/1.6/data/init-influxdb.sh b/influxdb/1.6/data/init-influxdb.sh index c2097ecd8..2ab2b6e54 100755 --- a/influxdb/1.6/data/init-influxdb.sh +++ b/influxdb/1.6/data/init-influxdb.sh @@ -4,9 +4,9 @@ set -e AUTH_ENABLED="$INFLUXDB_HTTP_AUTH_ENABLED" if [ -z "$AUTH_ENABLED" ]; then - AUTH_ENABLED="$(grep -iE '^\s*auth-enabled\s*=\s*true' /etc/influxdb/influxdb.conf | grep -io 'true' | cat)" + AUTH_ENABLED="$(grep -iE '^\s*auth-enabled\s*=\s*(true|1)' /etc/influxdb/influxdb.conf | grep -ioE '(true|1)' | cat)" else - AUTH_ENABLED="$(echo "$INFLUXDB_HTTP_AUTH_ENABLED" | grep -io 'true' | cat)" + AUTH_ENABLED="$(echo "$INFLUXDB_HTTP_AUTH_ENABLED" | grep -ioE '(true|1)' | cat)" fi INIT_USERS=$([ ! -z "$AUTH_ENABLED" ] && [ ! -z "$INFLUXDB_ADMIN_USER" ] && echo 1 || echo) diff --git a/influxdb/1.6/init-influxdb.sh b/influxdb/1.6/init-influxdb.sh index c2097ecd8..2ab2b6e54 100755 --- a/influxdb/1.6/init-influxdb.sh +++ b/influxdb/1.6/init-influxdb.sh @@ -4,9 +4,9 @@ set -e AUTH_ENABLED="$INFLUXDB_HTTP_AUTH_ENABLED" if [ -z "$AUTH_ENABLED" ]; then - AUTH_ENABLED="$(grep -iE '^\s*auth-enabled\s*=\s*true' /etc/influxdb/influxdb.conf | grep -io 'true' | cat)" + AUTH_ENABLED="$(grep -iE '^\s*auth-enabled\s*=\s*(true|1)' /etc/influxdb/influxdb.conf | grep -ioE '(true|1)' | cat)" else - AUTH_ENABLED="$(echo "$INFLUXDB_HTTP_AUTH_ENABLED" | grep -io 'true' | cat)" + AUTH_ENABLED="$(echo "$INFLUXDB_HTTP_AUTH_ENABLED" | grep -ioE '(true|1)' | cat)" fi INIT_USERS=$([ ! -z "$AUTH_ENABLED" ] && [ ! -z "$INFLUXDB_ADMIN_USER" ] && echo 1 || echo) diff --git a/influxdb/circle-test.sh b/influxdb/circle-test.sh index d64dc3859..17787f76a 100755 --- a/influxdb/circle-test.sh +++ b/influxdb/circle-test.sh @@ -65,8 +65,8 @@ test_default_without_auth_enabled() { cleanup } -test_default_with_auth_enabled() { - log_msg 'Executing test_default_with_auth_enabled' +test_default_with_auth_enabled_by_true() { + log_msg 'Executing test_default_with_auth_enabled_by_true' setup '--env INFLUXDB_HTTP_AUTH_ENABLED=true' assert_contains "$(influx 'SHOW DATABASES' 2> /dev/null)" 'create admin user first or disable authentication' 'test_default_with_auth_enabled: influxdb should not be initialized' @@ -74,6 +74,15 @@ test_default_with_auth_enabled() { cleanup } +test_default_with_auth_enabled_by_1() { + log_msg 'Executing test_default_with_auth_enabled_by_1' + setup '--env INFLUXDB_HTTP_AUTH_ENABLED=1' + + assert_contains "$(influx 'SHOW DATABASES' 2> /dev/null)" 'create admin user first or disable authentication' 'test_default_with_auth_enabled: influxdb should not be initialized' + + cleanup +} + test_create_db() { log_msg 'Executing test_create_db' setup '--env INFLUXDB_DB=test_db' @@ -186,7 +195,7 @@ test_create_db_on_non_default_port() { cleanup } -influxdb_dockerfiles=$(find 'influxdb' -name nightly -prune -o -name Dockerfile -print0 | xargs -0 -I{} dirname {} | sed 's@^./@@' | sed 's@//*@/@g') +influxdb_dockerfiles=$(find 'influxdb' -name nightly -prune -o -name data -prune -o -name meta -prune -o -name Dockerfile -print0 | xargs -0 -I{} dirname {} | sed 's@^./@@' | sed 's@//*@/@g') for path in $influxdb_dockerfiles; do # Generate a tag by replacing the first slash with a colon and all remaining slashes with a dash. @@ -196,7 +205,9 @@ for path in $influxdb_dockerfiles; do test_default_without_auth_enabled - test_default_with_auth_enabled + test_default_with_auth_enabled_by_true + + test_default_with_auth_enabled_by_1 test_create_db diff --git a/influxdb/nightly/alpine/init-influxdb.sh b/influxdb/nightly/alpine/init-influxdb.sh index c2097ecd8..2ab2b6e54 100755 --- a/influxdb/nightly/alpine/init-influxdb.sh +++ b/influxdb/nightly/alpine/init-influxdb.sh @@ -4,9 +4,9 @@ set -e AUTH_ENABLED="$INFLUXDB_HTTP_AUTH_ENABLED" if [ -z "$AUTH_ENABLED" ]; then - AUTH_ENABLED="$(grep -iE '^\s*auth-enabled\s*=\s*true' /etc/influxdb/influxdb.conf | grep -io 'true' | cat)" + AUTH_ENABLED="$(grep -iE '^\s*auth-enabled\s*=\s*(true|1)' /etc/influxdb/influxdb.conf | grep -ioE '(true|1)' | cat)" else - AUTH_ENABLED="$(echo "$INFLUXDB_HTTP_AUTH_ENABLED" | grep -io 'true' | cat)" + AUTH_ENABLED="$(echo "$INFLUXDB_HTTP_AUTH_ENABLED" | grep -ioE '(true|1)' | cat)" fi INIT_USERS=$([ ! -z "$AUTH_ENABLED" ] && [ ! -z "$INFLUXDB_ADMIN_USER" ] && echo 1 || echo) diff --git a/influxdb/nightly/init-influxdb.sh b/influxdb/nightly/init-influxdb.sh index c2097ecd8..2ab2b6e54 100755 --- a/influxdb/nightly/init-influxdb.sh +++ b/influxdb/nightly/init-influxdb.sh @@ -4,9 +4,9 @@ set -e AUTH_ENABLED="$INFLUXDB_HTTP_AUTH_ENABLED" if [ -z "$AUTH_ENABLED" ]; then - AUTH_ENABLED="$(grep -iE '^\s*auth-enabled\s*=\s*true' /etc/influxdb/influxdb.conf | grep -io 'true' | cat)" + AUTH_ENABLED="$(grep -iE '^\s*auth-enabled\s*=\s*(true|1)' /etc/influxdb/influxdb.conf | grep -ioE '(true|1)' | cat)" else - AUTH_ENABLED="$(echo "$INFLUXDB_HTTP_AUTH_ENABLED" | grep -io 'true' | cat)" + AUTH_ENABLED="$(echo "$INFLUXDB_HTTP_AUTH_ENABLED" | grep -ioE '(true|1)' | cat)" fi INIT_USERS=$([ ! -z "$AUTH_ENABLED" ] && [ ! -z "$INFLUXDB_ADMIN_USER" ] && echo 1 || echo) From d307af308de5ef508da893a5a170957ddce7636c Mon Sep 17 00:00:00 2001 From: PSanetra Date: Thu, 2 Aug 2018 21:12:06 +0200 Subject: [PATCH 2/2] init-influxdb.sh: Support keywords as database name --- influxdb/1.5/alpine/init-influxdb.sh | 2 +- influxdb/1.5/data/alpine/init-influxdb.sh | 2 +- influxdb/1.5/data/init-influxdb.sh | 2 +- influxdb/1.5/init-influxdb.sh | 2 +- influxdb/1.6/alpine/init-influxdb.sh | 2 +- influxdb/1.6/data/alpine/init-influxdb.sh | 2 +- influxdb/1.6/data/init-influxdb.sh | 2 +- influxdb/1.6/init-influxdb.sh | 2 +- influxdb/circle-test.sh | 10 +++++----- influxdb/nightly/alpine/init-influxdb.sh | 2 +- influxdb/nightly/init-influxdb.sh | 2 +- 11 files changed, 15 insertions(+), 15 deletions(-) diff --git a/influxdb/1.5/alpine/init-influxdb.sh b/influxdb/1.5/alpine/init-influxdb.sh index 2ab2b6e54..79d3ada7c 100755 --- a/influxdb/1.5/alpine/init-influxdb.sh +++ b/influxdb/1.5/alpine/init-influxdb.sh @@ -14,7 +14,7 @@ INIT_USERS=$([ ! -z "$AUTH_ENABLED" ] && [ ! -z "$INFLUXDB_ADMIN_USER" ] && echo if ( [ ! -z "$INIT_USERS" ] || [ ! -z "$INFLUXDB_DB" ] || [ "$(ls -A /docker-entrypoint-initdb.d 2> /dev/null)" ] ) && [ ! "$(ls -d /var/lib/influxdb/meta 2>/dev/null)" ]; then INIT_QUERY="" - CREATE_DB_QUERY="CREATE DATABASE $INFLUXDB_DB" + CREATE_DB_QUERY="CREATE DATABASE \"$INFLUXDB_DB\"" if [ ! -z "$INIT_USERS" ]; then diff --git a/influxdb/1.5/data/alpine/init-influxdb.sh b/influxdb/1.5/data/alpine/init-influxdb.sh index 2ab2b6e54..79d3ada7c 100755 --- a/influxdb/1.5/data/alpine/init-influxdb.sh +++ b/influxdb/1.5/data/alpine/init-influxdb.sh @@ -14,7 +14,7 @@ INIT_USERS=$([ ! -z "$AUTH_ENABLED" ] && [ ! -z "$INFLUXDB_ADMIN_USER" ] && echo if ( [ ! -z "$INIT_USERS" ] || [ ! -z "$INFLUXDB_DB" ] || [ "$(ls -A /docker-entrypoint-initdb.d 2> /dev/null)" ] ) && [ ! "$(ls -d /var/lib/influxdb/meta 2>/dev/null)" ]; then INIT_QUERY="" - CREATE_DB_QUERY="CREATE DATABASE $INFLUXDB_DB" + CREATE_DB_QUERY="CREATE DATABASE \"$INFLUXDB_DB\"" if [ ! -z "$INIT_USERS" ]; then diff --git a/influxdb/1.5/data/init-influxdb.sh b/influxdb/1.5/data/init-influxdb.sh index 2ab2b6e54..79d3ada7c 100755 --- a/influxdb/1.5/data/init-influxdb.sh +++ b/influxdb/1.5/data/init-influxdb.sh @@ -14,7 +14,7 @@ INIT_USERS=$([ ! -z "$AUTH_ENABLED" ] && [ ! -z "$INFLUXDB_ADMIN_USER" ] && echo if ( [ ! -z "$INIT_USERS" ] || [ ! -z "$INFLUXDB_DB" ] || [ "$(ls -A /docker-entrypoint-initdb.d 2> /dev/null)" ] ) && [ ! "$(ls -d /var/lib/influxdb/meta 2>/dev/null)" ]; then INIT_QUERY="" - CREATE_DB_QUERY="CREATE DATABASE $INFLUXDB_DB" + CREATE_DB_QUERY="CREATE DATABASE \"$INFLUXDB_DB\"" if [ ! -z "$INIT_USERS" ]; then diff --git a/influxdb/1.5/init-influxdb.sh b/influxdb/1.5/init-influxdb.sh index 2ab2b6e54..79d3ada7c 100755 --- a/influxdb/1.5/init-influxdb.sh +++ b/influxdb/1.5/init-influxdb.sh @@ -14,7 +14,7 @@ INIT_USERS=$([ ! -z "$AUTH_ENABLED" ] && [ ! -z "$INFLUXDB_ADMIN_USER" ] && echo if ( [ ! -z "$INIT_USERS" ] || [ ! -z "$INFLUXDB_DB" ] || [ "$(ls -A /docker-entrypoint-initdb.d 2> /dev/null)" ] ) && [ ! "$(ls -d /var/lib/influxdb/meta 2>/dev/null)" ]; then INIT_QUERY="" - CREATE_DB_QUERY="CREATE DATABASE $INFLUXDB_DB" + CREATE_DB_QUERY="CREATE DATABASE \"$INFLUXDB_DB\"" if [ ! -z "$INIT_USERS" ]; then diff --git a/influxdb/1.6/alpine/init-influxdb.sh b/influxdb/1.6/alpine/init-influxdb.sh index 2ab2b6e54..79d3ada7c 100755 --- a/influxdb/1.6/alpine/init-influxdb.sh +++ b/influxdb/1.6/alpine/init-influxdb.sh @@ -14,7 +14,7 @@ INIT_USERS=$([ ! -z "$AUTH_ENABLED" ] && [ ! -z "$INFLUXDB_ADMIN_USER" ] && echo if ( [ ! -z "$INIT_USERS" ] || [ ! -z "$INFLUXDB_DB" ] || [ "$(ls -A /docker-entrypoint-initdb.d 2> /dev/null)" ] ) && [ ! "$(ls -d /var/lib/influxdb/meta 2>/dev/null)" ]; then INIT_QUERY="" - CREATE_DB_QUERY="CREATE DATABASE $INFLUXDB_DB" + CREATE_DB_QUERY="CREATE DATABASE \"$INFLUXDB_DB\"" if [ ! -z "$INIT_USERS" ]; then diff --git a/influxdb/1.6/data/alpine/init-influxdb.sh b/influxdb/1.6/data/alpine/init-influxdb.sh index 2ab2b6e54..79d3ada7c 100755 --- a/influxdb/1.6/data/alpine/init-influxdb.sh +++ b/influxdb/1.6/data/alpine/init-influxdb.sh @@ -14,7 +14,7 @@ INIT_USERS=$([ ! -z "$AUTH_ENABLED" ] && [ ! -z "$INFLUXDB_ADMIN_USER" ] && echo if ( [ ! -z "$INIT_USERS" ] || [ ! -z "$INFLUXDB_DB" ] || [ "$(ls -A /docker-entrypoint-initdb.d 2> /dev/null)" ] ) && [ ! "$(ls -d /var/lib/influxdb/meta 2>/dev/null)" ]; then INIT_QUERY="" - CREATE_DB_QUERY="CREATE DATABASE $INFLUXDB_DB" + CREATE_DB_QUERY="CREATE DATABASE \"$INFLUXDB_DB\"" if [ ! -z "$INIT_USERS" ]; then diff --git a/influxdb/1.6/data/init-influxdb.sh b/influxdb/1.6/data/init-influxdb.sh index 2ab2b6e54..79d3ada7c 100755 --- a/influxdb/1.6/data/init-influxdb.sh +++ b/influxdb/1.6/data/init-influxdb.sh @@ -14,7 +14,7 @@ INIT_USERS=$([ ! -z "$AUTH_ENABLED" ] && [ ! -z "$INFLUXDB_ADMIN_USER" ] && echo if ( [ ! -z "$INIT_USERS" ] || [ ! -z "$INFLUXDB_DB" ] || [ "$(ls -A /docker-entrypoint-initdb.d 2> /dev/null)" ] ) && [ ! "$(ls -d /var/lib/influxdb/meta 2>/dev/null)" ]; then INIT_QUERY="" - CREATE_DB_QUERY="CREATE DATABASE $INFLUXDB_DB" + CREATE_DB_QUERY="CREATE DATABASE \"$INFLUXDB_DB\"" if [ ! -z "$INIT_USERS" ]; then diff --git a/influxdb/1.6/init-influxdb.sh b/influxdb/1.6/init-influxdb.sh index 2ab2b6e54..79d3ada7c 100755 --- a/influxdb/1.6/init-influxdb.sh +++ b/influxdb/1.6/init-influxdb.sh @@ -14,7 +14,7 @@ INIT_USERS=$([ ! -z "$AUTH_ENABLED" ] && [ ! -z "$INFLUXDB_ADMIN_USER" ] && echo if ( [ ! -z "$INIT_USERS" ] || [ ! -z "$INFLUXDB_DB" ] || [ "$(ls -A /docker-entrypoint-initdb.d 2> /dev/null)" ] ) && [ ! "$(ls -d /var/lib/influxdb/meta 2>/dev/null)" ]; then INIT_QUERY="" - CREATE_DB_QUERY="CREATE DATABASE $INFLUXDB_DB" + CREATE_DB_QUERY="CREATE DATABASE \"$INFLUXDB_DB\"" if [ ! -z "$INIT_USERS" ]; then diff --git a/influxdb/circle-test.sh b/influxdb/circle-test.sh index 17787f76a..f8d4d2ad5 100755 --- a/influxdb/circle-test.sh +++ b/influxdb/circle-test.sh @@ -83,11 +83,11 @@ test_default_with_auth_enabled_by_1() { cleanup } -test_create_db() { - log_msg 'Executing test_create_db' - setup '--env INFLUXDB_DB=test_db' +test_create_db_with_keyword_name() { + log_msg 'Executing test_create_db_with_keyword_name' + setup '--env INFLUXDB_DB=database' - assert_contains "$(influx 'SHOW DATABASES')" 'test_db' 'test_create_db: influxdb should contain a test_db database' + assert_contains "$(influx 'SHOW DATABASES')" 'database' 'test_create_db_with_keyword_name: influxdb should contain a database with name "database"' cleanup } @@ -209,7 +209,7 @@ for path in $influxdb_dockerfiles; do test_default_with_auth_enabled_by_1 - test_create_db + test_create_db_with_keyword_name test_create_admin diff --git a/influxdb/nightly/alpine/init-influxdb.sh b/influxdb/nightly/alpine/init-influxdb.sh index 2ab2b6e54..79d3ada7c 100755 --- a/influxdb/nightly/alpine/init-influxdb.sh +++ b/influxdb/nightly/alpine/init-influxdb.sh @@ -14,7 +14,7 @@ INIT_USERS=$([ ! -z "$AUTH_ENABLED" ] && [ ! -z "$INFLUXDB_ADMIN_USER" ] && echo if ( [ ! -z "$INIT_USERS" ] || [ ! -z "$INFLUXDB_DB" ] || [ "$(ls -A /docker-entrypoint-initdb.d 2> /dev/null)" ] ) && [ ! "$(ls -d /var/lib/influxdb/meta 2>/dev/null)" ]; then INIT_QUERY="" - CREATE_DB_QUERY="CREATE DATABASE $INFLUXDB_DB" + CREATE_DB_QUERY="CREATE DATABASE \"$INFLUXDB_DB\"" if [ ! -z "$INIT_USERS" ]; then diff --git a/influxdb/nightly/init-influxdb.sh b/influxdb/nightly/init-influxdb.sh index 2ab2b6e54..79d3ada7c 100755 --- a/influxdb/nightly/init-influxdb.sh +++ b/influxdb/nightly/init-influxdb.sh @@ -14,7 +14,7 @@ INIT_USERS=$([ ! -z "$AUTH_ENABLED" ] && [ ! -z "$INFLUXDB_ADMIN_USER" ] && echo if ( [ ! -z "$INIT_USERS" ] || [ ! -z "$INFLUXDB_DB" ] || [ "$(ls -A /docker-entrypoint-initdb.d 2> /dev/null)" ] ) && [ ! "$(ls -d /var/lib/influxdb/meta 2>/dev/null)" ]; then INIT_QUERY="" - CREATE_DB_QUERY="CREATE DATABASE $INFLUXDB_DB" + CREATE_DB_QUERY="CREATE DATABASE \"$INFLUXDB_DB\"" if [ ! -z "$INIT_USERS" ]; then