From eccd16356d8855605099d7f263efb3907f3eee75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Jaouen?= Date: Tue, 29 Sep 2020 15:10:58 +0200 Subject: [PATCH] change possibly conflictual env var USERNAME (DSP-706) (#1719) * change possibly conflictual env var USERNAME * applying USER_NAME to the rest of the scripts Co-authored-by: Ivan Subotic <400790+subotic@users.noreply.github.com> --- webapi/scripts/fuseki-dump-repository.sh | 6 +++--- webapi/scripts/fuseki-empty-repository.sh | 6 +++--- webapi/scripts/fuseki-functions.sh | 12 ++++++------ webapi/scripts/fuseki-upload-repository.sh | 6 +++--- webapi/scripts/graphdb-dump-repository.sh | 6 +++--- webapi/scripts/graphdb-empty-repository.sh | 6 +++--- webapi/scripts/graphdb-upload-repository.sh | 6 +++--- webapi/scripts/wait-for-db.sh | 8 ++++---- 8 files changed, 28 insertions(+), 28 deletions(-) diff --git a/webapi/scripts/fuseki-dump-repository.sh b/webapi/scripts/fuseki-dump-repository.sh index 1a7260d7c8..07c9da7760 100755 --- a/webapi/scripts/fuseki-dump-repository.sh +++ b/webapi/scripts/fuseki-dump-repository.sh @@ -14,7 +14,7 @@ case $key in shift # past value ;; -u|--username) - USERNAME="$2" + USER_NAME="$2" shift # past argument shift # past value ;; @@ -38,7 +38,7 @@ set -- "${POSITIONAL[@]}" # restore positional parameters FILE="$1" -if [[ -z "${REPOSITORY}" || -z "${USERNAME}" || -z "${FILE}" ]]; then +if [[ -z "${REPOSITORY}" || -z "${USER_NAME}" || -z "${FILE}" ]]; then echo "Usage: $(basename "$0") -r|--repository REPOSITORY -u|--username USERNAME [-p|--password PASSWORD] [-h|--host HOST] FILE" exit 1 fi @@ -53,4 +53,4 @@ if [[ -z "${HOST}" ]]; then HOST="localhost:3030" fi -curl -sS -X GET -H "Accept: application/trig" -u "${USERNAME}:${PASSWORD}" "http://${HOST}/${REPOSITORY}" > "${FILE}" +curl -sS -X GET -H "Accept: application/trig" -u "${USER_NAME}:${PASSWORD}" "http://${HOST}/${REPOSITORY}" > "${FILE}" diff --git a/webapi/scripts/fuseki-empty-repository.sh b/webapi/scripts/fuseki-empty-repository.sh index cd4712f84a..4a63edff1e 100755 --- a/webapi/scripts/fuseki-empty-repository.sh +++ b/webapi/scripts/fuseki-empty-repository.sh @@ -14,7 +14,7 @@ case $key in shift # past value ;; -u|--username) - USERNAME="$2" + USER_NAME="$2" shift # past argument shift # past value ;; @@ -36,7 +36,7 @@ esac done set -- "${POSITIONAL[@]}" # restore positional parameters -if [[ -z "${REPOSITORY}" || -z "${USERNAME}" ]]; then +if [[ -z "${REPOSITORY}" || -z "${USER_NAME}" ]]; then echo "Usage: $(basename "$0") -r|--repository REPOSITORY -u|--username USERNAME [-p|--password PASSWORD] [-h|--host HOST]" exit 1 fi @@ -51,4 +51,4 @@ if [[ -z "${HOST}" ]]; then HOST="localhost:3030" fi -curl -sS -X POST -H "Content-Type: application/sparql-update" -d "DROP ALL" -u "${USERNAME}:${PASSWORD}" "http://${HOST}/${REPOSITORY}" +curl -sS -X POST -H "Content-Type: application/sparql-update" -d "DROP ALL" -u "${USER_NAME}:${PASSWORD}" "http://${HOST}/${REPOSITORY}" diff --git a/webapi/scripts/fuseki-functions.sh b/webapi/scripts/fuseki-functions.sh index a3ebd12957..173e675307 100644 --- a/webapi/scripts/fuseki-functions.sh +++ b/webapi/scripts/fuseki-functions.sh @@ -13,7 +13,7 @@ while [[ $# -gt 0 ]]; do shift # past value ;; -u | --username) - USERNAME="$2" + USER_NAME="$2" shift # past argument shift # past value ;; @@ -45,8 +45,8 @@ if [[ -z "${HOST}" ]]; then HOST="localhost:3030" fi -if [[ -z "${USERNAME}" ]]; then - USERNAME="admin" +if [[ -z "${USER_NAME}" ]]; then + USER_NAME="admin" fi if [[ -z "${PASSWORD}" ]]; then @@ -54,7 +54,7 @@ if [[ -z "${PASSWORD}" ]]; then fi delete-repository() { - STATUS=$(curl -s -o /dev/null -w '%{http_code}' -u ${USERNAME}:${PASSWORD} -X DELETE http://${HOST}/\$/datasets/${REPOSITORY}) + STATUS=$(curl -s -o /dev/null -w '%{http_code}' -u ${USER_NAME}:${PASSWORD} -X DELETE http://${HOST}/\$/datasets/${REPOSITORY}) if [ "${STATUS}" -eq 200 ]; then echo "==> delete repository done" @@ -67,7 +67,7 @@ delete-repository() { create-repository() { REPOSITORY_CONFIG=$(sed "s/@REPOSITORY@/${REPOSITORY}/g" ./fuseki-repository-config.ttl.template) - STATUS=$(curl -s -o /dev/null -w '%{http_code}' -u ${USERNAME}:${PASSWORD} -H "Content-Type:text/turtle; charset=utf-8" --data-raw "${REPOSITORY_CONFIG}" -X POST http://${HOST}/\$/datasets) + STATUS=$(curl -s -o /dev/null -w '%{http_code}' -u ${USER_NAME}:${PASSWORD} -H "Content-Type:text/turtle; charset=utf-8" --data-raw "${REPOSITORY_CONFIG}" -X POST http://${HOST}/\$/datasets) if [ "${STATUS}" -eq 200 ]; then echo "==> create repository done" @@ -79,7 +79,7 @@ create-repository() { } upload-graph() { - STATUS=$(curl -s -o /dev/null -w '%{http_code}' -u ${USERNAME}:${PASSWORD} -H "Content-Type:text/turtle; charset=utf-8" --data-binary @$1 -X PUT http://${HOST}/${REPOSITORY}\?graph\="$2") + STATUS=$(curl -s -o /dev/null -w '%{http_code}' -u ${USER_NAME}:${PASSWORD} -H "Content-Type:text/turtle; charset=utf-8" --data-binary @$1 -X PUT http://${HOST}/${REPOSITORY}\?graph\="$2") if [ "${STATUS}" -eq 201 ]; then echo "==> 201 Created: $1 -> $2" diff --git a/webapi/scripts/fuseki-upload-repository.sh b/webapi/scripts/fuseki-upload-repository.sh index 51401f7295..60d44fed87 100755 --- a/webapi/scripts/fuseki-upload-repository.sh +++ b/webapi/scripts/fuseki-upload-repository.sh @@ -14,7 +14,7 @@ case $key in shift # past value ;; -u|--username) - USERNAME="$2" + USER_NAME="$2" shift # past argument shift # past value ;; @@ -38,7 +38,7 @@ set -- "${POSITIONAL[@]}" # restore positional parameters FILE="$1" -if [[ -z "${REPOSITORY}" || -z "${USERNAME}" || -z "${FILE}" ]]; then +if [[ -z "${REPOSITORY}" || -z "${USER_NAME}" || -z "${FILE}" ]]; then echo "Usage: $(basename "$0") -r|--repository REPOSITORY -u|--username USERNAME [-p|--password PASSWORD] [-h|--host HOST] FILE" exit 1 fi @@ -53,4 +53,4 @@ if [[ -z "${HOST}" ]]; then HOST="localhost:3030" fi -curl -sS -X POST -H "Content-Type: application/trig" --data-binary "@${FILE}" -u "${USERNAME}:${PASSWORD}" "http://${HOST}/${REPOSITORY}" | tee /dev/null +curl -sS -X POST -H "Content-Type: application/trig" --data-binary "@${FILE}" -u "${USER_NAME}:${PASSWORD}" "http://${HOST}/${REPOSITORY}" | tee /dev/null diff --git a/webapi/scripts/graphdb-dump-repository.sh b/webapi/scripts/graphdb-dump-repository.sh index ade47adca7..db930d6d78 100755 --- a/webapi/scripts/graphdb-dump-repository.sh +++ b/webapi/scripts/graphdb-dump-repository.sh @@ -14,7 +14,7 @@ case $key in shift # past value ;; -u|--username) - USERNAME="$2" + USER_NAME="$2" shift # past argument shift # past value ;; @@ -38,7 +38,7 @@ set -- "${POSITIONAL[@]}" # restore positional parameters FILE="$1" -if [[ -z "${REPOSITORY}" || -z "${USERNAME}" || -z "${FILE}" ]]; then +if [[ -z "${REPOSITORY}" || -z "${USER_NAME}" || -z "${FILE}" ]]; then echo "Usage: $(basename "$0") -r|--repository REPOSITORY -u|--username USERNAME [-p|--password PASSWORD] [-h|--host HOST] FILE" exit 1 fi @@ -53,4 +53,4 @@ if [[ -z "${HOST}" ]]; then HOST="localhost:7200" fi -curl -sS -X GET -H "Accept: application/trig" -u "${USERNAME}:${PASSWORD}" "http://${HOST}/repositories/${REPOSITORY}/statements?infer=false" > "${FILE}" +curl -sS -X GET -H "Accept: application/trig" -u "${USER_NAME}:${PASSWORD}" "http://${HOST}/repositories/${REPOSITORY}/statements?infer=false" > "${FILE}" diff --git a/webapi/scripts/graphdb-empty-repository.sh b/webapi/scripts/graphdb-empty-repository.sh index 5788036dc1..2c4f60af08 100755 --- a/webapi/scripts/graphdb-empty-repository.sh +++ b/webapi/scripts/graphdb-empty-repository.sh @@ -14,7 +14,7 @@ case $key in shift # past value ;; -u|--username) - USERNAME="$2" + USER_NAME="$2" shift # past argument shift # past value ;; @@ -36,7 +36,7 @@ esac done set -- "${POSITIONAL[@]}" # restore positional parameters -if [[ -z "${REPOSITORY}" || -z "${USERNAME}" ]]; then +if [[ -z "${REPOSITORY}" || -z "${USER_NAME}" ]]; then echo "Usage: $(basename "$0") -r|--repository REPOSITORY -u|--username USERNAME [-p|--password PASSWORD] [-h|--host HOST]" exit 1 fi @@ -51,4 +51,4 @@ if [[ -z "${HOST}" ]]; then HOST="localhost:7200" fi -curl -sS -X POST -H "Content-Type: application/sparql-update" -d "DROP ALL" -u "${USERNAME}:${PASSWORD}" "http://${HOST}/repositories/${REPOSITORY}/statements" +curl -sS -X POST -H "Content-Type: application/sparql-update" -d "DROP ALL" -u "${USER_NAME}:${PASSWORD}" "http://${HOST}/repositories/${REPOSITORY}/statements" diff --git a/webapi/scripts/graphdb-upload-repository.sh b/webapi/scripts/graphdb-upload-repository.sh index 95064840cb..f837a66cfb 100755 --- a/webapi/scripts/graphdb-upload-repository.sh +++ b/webapi/scripts/graphdb-upload-repository.sh @@ -14,7 +14,7 @@ case $key in shift # past value ;; -u|--username) - USERNAME="$2" + USER_NAME="$2" shift # past argument shift # past value ;; @@ -38,7 +38,7 @@ set -- "${POSITIONAL[@]}" # restore positional parameters FILE="$1" -if [[ -z "${REPOSITORY}" || -z "${USERNAME}" || -z "${FILE}" ]]; then +if [[ -z "${REPOSITORY}" || -z "${USER_NAME}" || -z "${FILE}" ]]; then echo "Usage: $(basename "$0") -r|--repository REPOSITORY -u|--username USERNAME [-p|--password PASSWORD] [-h|--host HOST] FILE" exit 1 fi @@ -53,4 +53,4 @@ if [[ -z "${HOST}" ]]; then HOST="localhost:7200" fi -curl -sS -X POST -H "Content-Type: application/trig" --data-binary "@${FILE}" -u "${USERNAME}:${PASSWORD}" "http://${HOST}/repositories/${REPOSITORY}/statements" | tee /dev/null +curl -sS -X POST -H "Content-Type: application/trig" --data-binary "@${FILE}" -u "${USER_NAME}:${PASSWORD}" "http://${HOST}/repositories/${REPOSITORY}/statements" | tee /dev/null diff --git a/webapi/scripts/wait-for-db.sh b/webapi/scripts/wait-for-db.sh index 93e5fee5ac..0310fb280e 100755 --- a/webapi/scripts/wait-for-db.sh +++ b/webapi/scripts/wait-for-db.sh @@ -21,7 +21,7 @@ while [[ $# -gt 0 ]]; do ;; -u | --username) - USERNAME="$2" + USER_NAME="$2" shift # past argument shift # past value ;; @@ -48,8 +48,8 @@ if [[ -z "${TIMEOUT}" ]]; then TIMEOUT=360 fi -if [[ -z "${USERNAME}" ]]; then - USERNAME="admin" +if [[ -z "${USER_NAME}" ]]; then + USER_NAME="admin" fi if [[ -z "${PASSWORD}" ]]; then @@ -57,7 +57,7 @@ if [[ -z "${PASSWORD}" ]]; then fi poll-db() { - STATUS=$(curl -s -o /dev/null -w '%{http_code}' -u ${USERNAME}:${PASSWORD} http://${HOST}/\$/server) + STATUS=$(curl -s -o /dev/null -w '%{http_code}' -u ${USER_NAME}:${PASSWORD} http://${HOST}/\$/server) if [ "${STATUS}" -eq 200 ]; then echo "==> DB started"