fix: lint all Salt file extensions

This commit is contained in:
Ben Grande 2024-07-18 12:23:38 +02:00
parent f5fe9737a2
commit fa11a1da7f
No known key found for this signature in database
GPG Key ID: 00C64E14F51F9E56
2 changed files with 6 additions and 4 deletions

View File

@ -65,7 +65,7 @@ repos:
entry: scripts/salt-lint.sh entry: scripts/salt-lint.sh
language: script language: script
pass_filenames: true pass_filenames: true
files: (^minion.d/.*.conf|\.(sls|top))$ files: (^minion.d/.*.conf|\.(sls|top|jinja|j2|tmpl|tst))$
description: Lint Salt files description: Lint Salt files
- id: yaml-lint - id: yaml-lint

View File

@ -24,7 +24,7 @@ if test -n "${1-}"; then
test -f "${f}" || continue test -f "${f}" || continue
extension="${f##*.}" extension="${f##*.}"
case "${extension}" in case "${extension}" in
top|sls) files="${files} ${f}";; top|sls|jinja|j2|tmpl|tst) files="${files} ${f}";;
*) continue;; *) continue;;
esac esac
done done
@ -35,13 +35,15 @@ fi
case "${find_tool}" in case "${find_tool}" in
fd|fdfind) fd|fdfind)
conf_files="$(${find_tool} . minion.d/ -e conf)" conf_files="$(${find_tool} . minion.d/ -e conf)"
sls_files="$(${find_tool} . salt/ -d 2 -t f -e sls -e top | sort -d)" sls_files="$(${find_tool} . salt/ -d 2 -t f -e sls -e top -e jinja \
-e j2 -e tmpl -e tst | sort -d)"
files="${conf_files}\n${sls_files}" files="${conf_files}\n${sls_files}"
;; ;;
find) find)
conf_files="$(find minion.d/ -type f -name "*.conf")" conf_files="$(find minion.d/ -type f -name "*.conf")"
sls_files="$(find salt/* -maxdepth 2 -type f \ sls_files="$(find salt/* -maxdepth 2 -type f \
\( -name '*.sls' -o -name '*.top' \) | sort -d)" \( -name '*.sls' -o -name '*.top' -o -name '*.jinja' \
-o -name '*.j2' -o -name '*.tmpl' -o -name '*.tst' \) | sort -d)"
files="${conf_files}\n${sls_files}" files="${conf_files}\n${sls_files}"
;; ;;
*) echo "Unsupported find tool" >&2; exit 1;; *) echo "Unsupported find tool" >&2; exit 1;;