From de9ac40e3f853d578823f18b399e84dedcfd93d0 Mon Sep 17 00:00:00 2001 From: Georg Pfuetzenreuter Date: Mon, 1 May 2023 21:45:13 +0200 Subject: Check files in nbroles to grains script Script is called in the Lysergic repository as well, where not all files exist. Signed-off-by: Georg Pfuetzenreuter --- bin/nbroles_to_grains.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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[@]} -- cgit v1.2.3