From 248f11c932348320cd8d8ffafba19d3d14995200 Mon Sep 17 00:00:00 2001 From: tabalt <245291359@qq.com> Date: Fri, 26 Jun 2020 09:33:54 +0800 Subject: [PATCH] Fixed apache/pulsar-helm-chart#25 (#27) --- charts/pulsar/templates/keytool.yaml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/charts/pulsar/templates/keytool.yaml b/charts/pulsar/templates/keytool.yaml index b3da4a0..aed05b0 100644 --- a/charts/pulsar/templates/keytool.yaml +++ b/charts/pulsar/templates/keytool.yaml @@ -40,19 +40,26 @@ data: keyStoreFile=/pulsar/${component}.keystore.jks trustStoreFile=/pulsar/${component}.truststore.jks - function ensureFileNotEmpty() { + function checkFile() { local file=$1 local len=$(wc -c ${file} | awk '{print $1}') echo "processing ${file} : len = ${len}" if [ ! -f ${file} ]; then echo "${file} is not found" - exit -1 + return -1 fi if [ $len -le 0 ]; then echo "${file} is empty" - exit -1 + return -1 fi } + + function ensureFileNotEmpty() { + local file=$1 + until checkFile ${file}; do + echo "file isn't initialized yet ... check in 3 seconds ..." && sleep 3; + done; + } ensureFileNotEmpty ${crtFile} ensureFileNotEmpty ${keyFile}