From f37bda68d624e8671289bad56459ddbaea7dac9a Mon Sep 17 00:00:00 2001
From: Andrii Nikitin <anikitin@suse.de>
Date: Aug 04 2023 11:30:33 +0000
Subject: test: Allow jinja in pillar/secrets


---

diff --git a/bin/test_secrets.sh b/bin/test_secrets.sh
index d645187..133bd99 100755
--- a/bin/test_secrets.sh
+++ b/bin/test_secrets.sh
@@ -4,20 +4,20 @@
 # appropriate header, and that none other pillar files contain this header or
 # any secrets
 
-HEADER="#!yaml|gpg"
+HEADER="yaml\\|gpg"
 
 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"
+        head -n 1 $secret_sls | grep -q -P "$HEADER" || {
+            echo "$secret_sls is missing pattern \"$HEADER\" in shebang"
             STATUS=1
-        fi
+        }
     done
 fi
 
 for sls in $(find pillar/ -not -path 'pillar/secrets/*' -name '*.sls'); do
-    if $(grep -q "$HEADER" $sls); then
+    if $(grep -q -P "$HEADER" $sls); then
         echo "$sls has the \"$HEADER\" header, please remove it"
         STATUS=1
     fi