summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorg Pfuetzenreuter2023-05-01 21:48:34 +0200
committerGeorg Pfuetzenreuter2023-05-01 21:48:34 +0200
commitbfeeb8673ebb017f5b8fe3505663c8d450be53f0 (patch)
tree03f6c376c43f677da33e7367aaae37f8eb71a16b
parentc951f48b710a46f0a532757d5a06462fa27d6f7d (diff)
parentde9ac40e3f853d578823f18b399e84dedcfd93d0 (diff)
downloadsalt-bfeeb8673ebb017f5b8fe3505663c8d450be53f0.tar.gz
salt-bfeeb8673ebb017f5b8fe3505663c8d450be53f0.tar.bz2
salt-bfeeb8673ebb017f5b8fe3505663c8d450be53f0.zip
Merge pull request 'Check files in nbroles to grains script' (#60) from nbroles-to-grains-refactor into production
Reviewed-on: https://git.com.de/LibertaCasa/salt/pulls/60
-rwxr-xr-xbin/nbroles_to_grains.sh12
1 files changed, 11 insertions, 1 deletions
diff --git a/bin/nbroles_to_grains.sh b/bin/nbroles_to_grains.sh
index 85cb52c..1ff5f69 100755
--- a/bin/nbroles_to_grains.sh
+++ b/bin/nbroles_to_grains.sh
@@ -1,4 +1,14 @@
#!/usr/bin/env sh
# This rewrites top-files to fetch roles from grains instead of our custom roles API. Useful for testing outside of the LibertaCasa infrastructure, but not recommended for production.
-sed -i "s/salt\['http.query'\].*/grains\['roles'\] -%}/" */top.sls salt/common/suse.sls
+potential_files=(*/top.sls salt/common/suse.sls)
+
+for file in ${potential_files[@]}
+do
+ if [ -f "$file" ]
+ then
+ files+="$file "
+ fi
+done
+
+sed -i "s/salt\['http.query'\].*/grains\['roles'\] -%}/" ${files[@]}