Signed-off-by: Wu Zhende wuzhende666@163.com --- sbin/es-regression-mapping.sh | 8 ++++++-- sbin/es-repo-mapping.sh | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/sbin/es-regression-mapping.sh b/sbin/es-regression-mapping.sh index 5ae0f71..9d01bf9 100755 --- a/sbin/es-regression-mapping.sh +++ b/sbin/es-regression-mapping.sh @@ -1,14 +1,18 @@ #!/bin/sh
+. $CCI_SRC/container/defconfig.sh + +load_service_authentication + # check whether regression index has created -status_code=$(curl -sSIL -w "%{http_code}\n" -o /dev/null http://localhost:9200/regression) +status_code=$(curl -sSIL -u "${ES_USER}:${ES_PASSWORD}" -w "%{http_code}\n" -o /dev/null http://localhost:9200/regression)
if [ "$status_code" -eq 200 ] then echo "regression index has been created, exit." else echo "begin create index." - curl -sSH 'Content-Type: Application/json' -XPUT 'http://localhost:9200/regression' -d '{ + curl -sSH 'Content-Type: Application/json' -XPUT 'http://localhost:9200/regression' -u "${ES_USER}:${ES_PASSWORD}" -d '{ "mappings": { "dynamic": false, "properties": { diff --git a/sbin/es-repo-mapping.sh b/sbin/es-repo-mapping.sh index 290efb3..368dc94 100755 --- a/sbin/es-repo-mapping.sh +++ b/sbin/es-repo-mapping.sh @@ -2,13 +2,17 @@ # SPDX-License-Identifier: MulanPSL-2.0+ # Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+. $CCI_SRC/container/defconfig.sh + +load_service_authentication + # Check if "repo" index already exists. -status_code=$(curl -sSIL -w "%{http_code}\n" -o /dev/null http://localhost:9200/repo) +status_code=$(curl -sSIL -u "${ES_USER}:${ES_PASSWORD}" -w "%{http_code}\n" -o /dev/null http://localhost:9200/repo) [ $status_code -eq 200 ] && echo '"repo" index already exists.' && exit
# Create "repo" index. echo 'Start to create "repo" index.' -curl -sSH 'Content-Type: Application/json' -XPUT 'http://localhost:9200/repo' -d ' +curl -sSH 'Content-Type: Application/json' -XPUT 'http://localhost:9200/repo' -u "${ES_USER}:${ES_PASSWORD}" -d ' { "mappings": { "properties": {