diff --git a/bin/test_secrets.sh b/bin/test_secrets.sh index 6fc4dc6..d645187 100755 --- a/bin/test_secrets.sh +++ b/bin/test_secrets.sh @@ -6,12 +6,15 @@ HEADER="#!yaml|gpg" -for secret_sls in $(find pillar/secrets -name '*.sls'); do - if [[ $(head -n 1 $secret_sls) != "$HEADER" ]]; then - echo "$secret_sls is missing the \"$HEADER\" header or it is not on the first line" - STATUS=1 - fi -done +SECRETS_SLS=$(find pillar/secrets -name '*.sls' 2> /dev/null) +if [[ -n $SECRETS_SLS ]]; then + for secret_sls in ${SECRETS_SLS[@]}; do + if [[ $(head -n 1 $secret_sls) != "$HEADER" ]]; then + echo "$secret_sls is missing the \"$HEADER\" header or it is not on the first line" + STATUS=1 + fi + done +fi for sls in $(find pillar/ -not -path 'pillar/secrets/*' -name '*.sls'); do if $(grep -q "$HEADER" $sls); then