forked from ungleich-public/cdist
Merge pull request #703 from tom-ee/fix-SC2045
fix SC2045 (use globs instead of `ls`)
This commit is contained in:
commit
66ca2fcb70
16 changed files with 30 additions and 17 deletions
|
@ -19,7 +19,8 @@
|
|||
#
|
||||
|
||||
set -- "/${__object_id}"
|
||||
for param in $(ls "$__object/parameter/"); do
|
||||
cd "$__object/parameter/"
|
||||
for param in *; do
|
||||
case "$param" in
|
||||
source)
|
||||
source="$(cat "$__object/parameter/source")"
|
||||
|
|
|
@ -84,7 +84,8 @@ echo "{"
|
|||
# parameters we define ourself
|
||||
printf ' "data_dir": "%s"\n' "$data_dir"
|
||||
|
||||
for param in $(ls "$__object/parameter/"); do
|
||||
cd "$__object/parameter/"
|
||||
for param in *; do
|
||||
case "$param" in
|
||||
state|user|group|json-config) continue ;;
|
||||
ca-file-source|cert-file-source|key-file-source)
|
||||
|
|
|
@ -50,7 +50,8 @@ fi
|
|||
echo "{"
|
||||
printf ' "check": {\n'
|
||||
printf ' "name": "%s"\n' "$name"
|
||||
for param in $(ls "$__object/parameter/"); do
|
||||
cd "$__object/parameter/"
|
||||
for param in *; do
|
||||
case "$param" in
|
||||
state|name) continue ;;
|
||||
*)
|
||||
|
|
|
@ -42,7 +42,8 @@ fi
|
|||
echo "{"
|
||||
printf ' "service": {\n'
|
||||
printf ' "name": "%s"\n' "$name"
|
||||
for param in $(ls "$__object/parameter/"); do
|
||||
cd "$__object/parameter/"
|
||||
for param in *; do
|
||||
case "$param" in
|
||||
state|name|check-interval) continue ;;
|
||||
check-script)
|
||||
|
|
|
@ -75,7 +75,8 @@ require="__directory/etc/consul-template" \
|
|||
|
||||
# Generate hcl config file
|
||||
(
|
||||
for param in $(ls "$__object/parameter/"); do
|
||||
cd "$__object/parameter/"
|
||||
for param in *; do
|
||||
case "$param" in
|
||||
auth-password|state|ssl-*|syslog-*|version|vault-token|vault-ssl*) continue ;;
|
||||
auth-username)
|
||||
|
|
|
@ -38,7 +38,8 @@ fi
|
|||
# Generate hcl config file
|
||||
(
|
||||
printf 'template {\n'
|
||||
for param in $(ls "$__object/parameter/"); do
|
||||
cd "$__object/parameter/"
|
||||
for param in *; do
|
||||
case "$param" in
|
||||
source-file)
|
||||
source="$(cat "$__object/parameter/$param")"
|
||||
|
|
|
@ -35,7 +35,8 @@ fi
|
|||
echo "{"
|
||||
printf ' "watches": [{\n'
|
||||
printf ' "type": "%s"\n' "$watch_type"
|
||||
for param in $(ls "$__object/parameter/"); do
|
||||
cd "$__object/parameter/"
|
||||
for param in *; do
|
||||
case "$param" in
|
||||
state) continue ;;
|
||||
filter-*)
|
||||
|
|
|
@ -29,7 +29,8 @@ state="$(cat "$__object/parameter/state")"
|
|||
echo "{"
|
||||
printf ' "watches": [{\n'
|
||||
printf ' "type": "%s"\n' "$watch_type"
|
||||
for param in $(ls "$__object/parameter/"); do
|
||||
cd "$__object/parameter/"
|
||||
for param in *; do
|
||||
case "$param" in
|
||||
state) continue ;;
|
||||
*)
|
||||
|
|
|
@ -29,7 +29,8 @@ state="$(cat "$__object/parameter/state")"
|
|||
echo "{"
|
||||
printf ' "watches": [{\n'
|
||||
printf ' "type": "%s"\n' "$watch_type"
|
||||
for param in $(ls "$__object/parameter/"); do
|
||||
cd "$__object/parameter/"
|
||||
for param in *; do
|
||||
case "$param" in
|
||||
state) continue ;;
|
||||
*)
|
||||
|
|
|
@ -29,7 +29,8 @@ state="$(cat "$__object/parameter/state")"
|
|||
echo "{"
|
||||
printf ' "watches": [{\n'
|
||||
printf ' "type": "%s"\n' "$watch_type"
|
||||
for param in $(ls "$__object/parameter/"); do
|
||||
cd "$__object/parameter/"
|
||||
for param in *; do
|
||||
case "$param" in
|
||||
state) continue ;;
|
||||
*)
|
||||
|
|
|
@ -29,7 +29,8 @@ state="$(cat "$__object/parameter/state")"
|
|||
echo "{"
|
||||
printf ' "watches": [{\n'
|
||||
printf ' "type": "%s"\n' "$watch_type"
|
||||
for param in $(ls "$__object/parameter/"); do
|
||||
cd "$__object/parameter/"
|
||||
for param in *; do
|
||||
case "$param" in
|
||||
state) continue ;;
|
||||
*)
|
||||
|
|
|
@ -29,7 +29,8 @@ state="$(cat "$__object/parameter/state")"
|
|||
echo "{"
|
||||
printf ' "watches": [{\n'
|
||||
printf ' "type": "%s"\n' "$watch_type"
|
||||
for param in $(ls "$__object/parameter/"); do
|
||||
cd "$__object/parameter/"
|
||||
for param in *; do
|
||||
case "$param" in
|
||||
state) continue ;;
|
||||
passingonly)
|
||||
|
|
|
@ -29,7 +29,8 @@ state="$(cat "$__object/parameter/state")"
|
|||
echo "{"
|
||||
printf ' "watches": [{\n'
|
||||
printf ' "type": "%s"\n' "$watch_type"
|
||||
for param in $(ls "$__object/parameter/"); do
|
||||
cd "$__object/parameter/"
|
||||
for param in *; do
|
||||
case "$param" in
|
||||
state) continue ;;
|
||||
*)
|
||||
|
|
|
@ -39,7 +39,7 @@ __directory ${jaildir} --parents
|
|||
|
||||
set -- "$@" "$__object_id" "--state" "$state"
|
||||
cd "$__object/parameter"
|
||||
for property in $(ls .); do
|
||||
for property in *; do
|
||||
set -- "$@" "--$property" "$(cat "$property")"
|
||||
done
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ state="$(cat "$__object/parameter/state")"
|
|||
|
||||
set -- "$@" "$__object_id" "--state" "$state"
|
||||
cd "$__object/parameter"
|
||||
for property in $(ls .); do
|
||||
for property in *; do
|
||||
if [ "$property" != "type" ] && [ "$property" != "state" ]; then
|
||||
set -- "$@" "--$property" "$(cat "$property")"
|
||||
fi
|
||||
|
|
|
@ -52,7 +52,7 @@ shorten_property() {
|
|||
if [ "$state" = "present" ]; then
|
||||
cd "$__object/parameter"
|
||||
if grep -q "^${name}:" "$__object/explorer/passwd"; then
|
||||
for property in $(ls .); do
|
||||
for property in *; do
|
||||
new_value="$(cat "$property")"
|
||||
unset current_value
|
||||
|
||||
|
@ -113,7 +113,7 @@ if [ "$state" = "present" ]; then
|
|||
fi
|
||||
else
|
||||
echo add >> "$__messages_out"
|
||||
for property in $(ls .); do
|
||||
for property in *; do
|
||||
[ "$property" = "state" ] && continue
|
||||
[ "$property" = "remove-home" ] && continue
|
||||
new_value="$(cat "$property")"
|
||||
|
|
Loading…
Reference in a new issue