Fixed apache/pulsar-helm-chart#25 (#27)

This commit is contained in:
tabalt 2020-06-26 09:33:54 +08:00 committed by GitHub
parent 9778ce2fe1
commit 248f11c932
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -40,20 +40,27 @@ data:
keyStoreFile=/pulsar/${component}.keystore.jks keyStoreFile=/pulsar/${component}.keystore.jks
trustStoreFile=/pulsar/${component}.truststore.jks trustStoreFile=/pulsar/${component}.truststore.jks
function ensureFileNotEmpty() { function checkFile() {
local file=$1 local file=$1
local len=$(wc -c ${file} | awk '{print $1}') local len=$(wc -c ${file} | awk '{print $1}')
echo "processing ${file} : len = ${len}" echo "processing ${file} : len = ${len}"
if [ ! -f ${file} ]; then if [ ! -f ${file} ]; then
echo "${file} is not found" echo "${file} is not found"
exit -1 return -1
fi fi
if [ $len -le 0 ]; then if [ $len -le 0 ]; then
echo "${file} is empty" echo "${file} is empty"
exit -1 return -1
fi 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 ${crtFile}
ensureFileNotEmpty ${keyFile} ensureFileNotEmpty ${keyFile}
ensureFileNotEmpty ${caFile} ensureFileNotEmpty ${caFile}