Merge pull request #703 from tom-ee/fix-SC2045

fix SC2045 (use globs instead of `ls`)
This commit is contained in:
Darko Poljak 2018-10-04 17:31:34 +02:00 committed by GitHub
commit 66ca2fcb70
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 30 additions and 17 deletions

View file

@ -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")"

View file

@ -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)

View file

@ -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 ;;
*)

View file

@ -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)

View file

@ -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)

View file

@ -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")"

View file

@ -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-*)

View file

@ -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 ;;
*)

View file

@ -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 ;;
*)

View file

@ -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 ;;
*)

View file

@ -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 ;;
*)

View file

@ -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)

View file

@ -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 ;;
*)

View file

@ -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

View file

@ -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

View file

@ -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")"