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}"
 | 
					set -- "/${__object_id}"
 | 
				
			||||||
for param in $(ls "$__object/parameter/"); do
 | 
					cd "$__object/parameter/"
 | 
				
			||||||
 | 
					for param in *; do
 | 
				
			||||||
   case "$param" in
 | 
					   case "$param" in
 | 
				
			||||||
      source)
 | 
					      source)
 | 
				
			||||||
         source="$(cat "$__object/parameter/source")"
 | 
					         source="$(cat "$__object/parameter/source")"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -84,7 +84,8 @@ echo "{"
 | 
				
			||||||
# parameters we define ourself
 | 
					# parameters we define ourself
 | 
				
			||||||
printf '   "data_dir": "%s"\n' "$data_dir"
 | 
					printf '   "data_dir": "%s"\n' "$data_dir"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
for param in $(ls "$__object/parameter/"); do
 | 
					cd "$__object/parameter/"
 | 
				
			||||||
 | 
					for param in *; do
 | 
				
			||||||
   case "$param" in
 | 
					   case "$param" in
 | 
				
			||||||
      state|user|group|json-config) continue ;;
 | 
					      state|user|group|json-config) continue ;;
 | 
				
			||||||
      ca-file-source|cert-file-source|key-file-source)
 | 
					      ca-file-source|cert-file-source|key-file-source)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -50,7 +50,8 @@ fi
 | 
				
			||||||
echo "{"
 | 
					echo "{"
 | 
				
			||||||
printf '   "check": {\n'
 | 
					printf '   "check": {\n'
 | 
				
			||||||
printf '      "name": "%s"\n' "$name"
 | 
					printf '      "name": "%s"\n' "$name"
 | 
				
			||||||
for param in $(ls "$__object/parameter/"); do
 | 
					cd "$__object/parameter/"
 | 
				
			||||||
 | 
					for param in *; do
 | 
				
			||||||
   case "$param" in
 | 
					   case "$param" in
 | 
				
			||||||
      state|name) continue ;;
 | 
					      state|name) continue ;;
 | 
				
			||||||
      *)
 | 
					      *)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -42,7 +42,8 @@ fi
 | 
				
			||||||
echo "{"
 | 
					echo "{"
 | 
				
			||||||
printf '   "service": {\n'
 | 
					printf '   "service": {\n'
 | 
				
			||||||
printf '      "name": "%s"\n' "$name"
 | 
					printf '      "name": "%s"\n' "$name"
 | 
				
			||||||
for param in $(ls "$__object/parameter/"); do
 | 
					cd "$__object/parameter/"
 | 
				
			||||||
 | 
					for param in *; do
 | 
				
			||||||
   case "$param" in
 | 
					   case "$param" in
 | 
				
			||||||
      state|name|check-interval) continue ;;
 | 
					      state|name|check-interval) continue ;;
 | 
				
			||||||
      check-script)
 | 
					      check-script)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -75,7 +75,8 @@ require="__directory/etc/consul-template" \
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Generate hcl config file
 | 
					# Generate hcl config file
 | 
				
			||||||
(
 | 
					(
 | 
				
			||||||
for param in $(ls "$__object/parameter/"); do
 | 
					cd "$__object/parameter/"
 | 
				
			||||||
 | 
					for param in *; do
 | 
				
			||||||
   case "$param" in
 | 
					   case "$param" in
 | 
				
			||||||
      auth-password|state|ssl-*|syslog-*|version|vault-token|vault-ssl*) continue ;;
 | 
					      auth-password|state|ssl-*|syslog-*|version|vault-token|vault-ssl*) continue ;;
 | 
				
			||||||
      auth-username)
 | 
					      auth-username)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -38,7 +38,8 @@ fi
 | 
				
			||||||
# Generate hcl config file
 | 
					# Generate hcl config file
 | 
				
			||||||
(
 | 
					(
 | 
				
			||||||
printf 'template {\n'
 | 
					printf 'template {\n'
 | 
				
			||||||
for param in $(ls "$__object/parameter/"); do
 | 
					cd "$__object/parameter/"
 | 
				
			||||||
 | 
					for param in *; do
 | 
				
			||||||
   case "$param" in
 | 
					   case "$param" in
 | 
				
			||||||
      source-file)
 | 
					      source-file)
 | 
				
			||||||
         source="$(cat "$__object/parameter/$param")"
 | 
					         source="$(cat "$__object/parameter/$param")"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -35,7 +35,8 @@ fi
 | 
				
			||||||
echo "{"
 | 
					echo "{"
 | 
				
			||||||
printf '   "watches": [{\n'
 | 
					printf '   "watches": [{\n'
 | 
				
			||||||
printf '      "type": "%s"\n' "$watch_type"
 | 
					printf '      "type": "%s"\n' "$watch_type"
 | 
				
			||||||
for param in $(ls "$__object/parameter/"); do
 | 
					cd "$__object/parameter/"
 | 
				
			||||||
 | 
					for param in *; do
 | 
				
			||||||
   case "$param" in
 | 
					   case "$param" in
 | 
				
			||||||
      state) continue ;;
 | 
					      state) continue ;;
 | 
				
			||||||
      filter-*)
 | 
					      filter-*)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -29,7 +29,8 @@ state="$(cat "$__object/parameter/state")"
 | 
				
			||||||
echo "{"
 | 
					echo "{"
 | 
				
			||||||
printf '   "watches": [{\n'
 | 
					printf '   "watches": [{\n'
 | 
				
			||||||
printf '      "type": "%s"\n' "$watch_type"
 | 
					printf '      "type": "%s"\n' "$watch_type"
 | 
				
			||||||
for param in $(ls "$__object/parameter/"); do
 | 
					cd "$__object/parameter/"
 | 
				
			||||||
 | 
					for param in *; do
 | 
				
			||||||
   case "$param" in
 | 
					   case "$param" in
 | 
				
			||||||
      state) continue ;;
 | 
					      state) continue ;;
 | 
				
			||||||
      *)
 | 
					      *)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -29,7 +29,8 @@ state="$(cat "$__object/parameter/state")"
 | 
				
			||||||
echo "{"
 | 
					echo "{"
 | 
				
			||||||
printf '   "watches": [{\n'
 | 
					printf '   "watches": [{\n'
 | 
				
			||||||
printf '      "type": "%s"\n' "$watch_type"
 | 
					printf '      "type": "%s"\n' "$watch_type"
 | 
				
			||||||
for param in $(ls "$__object/parameter/"); do
 | 
					cd "$__object/parameter/"
 | 
				
			||||||
 | 
					for param in *; do
 | 
				
			||||||
   case "$param" in
 | 
					   case "$param" in
 | 
				
			||||||
      state) continue ;;
 | 
					      state) continue ;;
 | 
				
			||||||
      *)
 | 
					      *)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -29,7 +29,8 @@ state="$(cat "$__object/parameter/state")"
 | 
				
			||||||
echo "{"
 | 
					echo "{"
 | 
				
			||||||
printf '   "watches": [{\n'
 | 
					printf '   "watches": [{\n'
 | 
				
			||||||
printf '      "type": "%s"\n' "$watch_type"
 | 
					printf '      "type": "%s"\n' "$watch_type"
 | 
				
			||||||
for param in $(ls "$__object/parameter/"); do
 | 
					cd "$__object/parameter/"
 | 
				
			||||||
 | 
					for param in *; do
 | 
				
			||||||
   case "$param" in
 | 
					   case "$param" in
 | 
				
			||||||
      state) continue ;;
 | 
					      state) continue ;;
 | 
				
			||||||
      *)
 | 
					      *)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -29,7 +29,8 @@ state="$(cat "$__object/parameter/state")"
 | 
				
			||||||
echo "{"
 | 
					echo "{"
 | 
				
			||||||
printf '   "watches": [{\n'
 | 
					printf '   "watches": [{\n'
 | 
				
			||||||
printf '      "type": "%s"\n' "$watch_type"
 | 
					printf '      "type": "%s"\n' "$watch_type"
 | 
				
			||||||
for param in $(ls "$__object/parameter/"); do
 | 
					cd "$__object/parameter/"
 | 
				
			||||||
 | 
					for param in *; do
 | 
				
			||||||
   case "$param" in
 | 
					   case "$param" in
 | 
				
			||||||
      state) continue ;;
 | 
					      state) continue ;;
 | 
				
			||||||
      *)
 | 
					      *)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -29,7 +29,8 @@ state="$(cat "$__object/parameter/state")"
 | 
				
			||||||
echo "{"
 | 
					echo "{"
 | 
				
			||||||
printf '   "watches": [{\n'
 | 
					printf '   "watches": [{\n'
 | 
				
			||||||
printf '      "type": "%s"\n' "$watch_type"
 | 
					printf '      "type": "%s"\n' "$watch_type"
 | 
				
			||||||
for param in $(ls "$__object/parameter/"); do
 | 
					cd "$__object/parameter/"
 | 
				
			||||||
 | 
					for param in *; do
 | 
				
			||||||
   case "$param" in
 | 
					   case "$param" in
 | 
				
			||||||
      state) continue ;;
 | 
					      state) continue ;;
 | 
				
			||||||
      passingonly)
 | 
					      passingonly)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -29,7 +29,8 @@ state="$(cat "$__object/parameter/state")"
 | 
				
			||||||
echo "{"
 | 
					echo "{"
 | 
				
			||||||
printf '   "watches": [{\n'
 | 
					printf '   "watches": [{\n'
 | 
				
			||||||
printf '      "type": "%s"\n' "$watch_type"
 | 
					printf '      "type": "%s"\n' "$watch_type"
 | 
				
			||||||
for param in $(ls "$__object/parameter/"); do
 | 
					cd "$__object/parameter/"
 | 
				
			||||||
 | 
					for param in *; do
 | 
				
			||||||
   case "$param" in
 | 
					   case "$param" in
 | 
				
			||||||
      state) continue ;;
 | 
					      state) continue ;;
 | 
				
			||||||
      *)
 | 
					      *)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -39,7 +39,7 @@ __directory ${jaildir} --parents
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set -- "$@" "$__object_id" "--state" "$state"
 | 
					set -- "$@" "$__object_id" "--state" "$state"
 | 
				
			||||||
cd "$__object/parameter"
 | 
					cd "$__object/parameter"
 | 
				
			||||||
for property in $(ls .); do
 | 
					for property in *; do
 | 
				
			||||||
	set -- "$@" "--$property" "$(cat "$property")"
 | 
						set -- "$@" "--$property" "$(cat "$property")"
 | 
				
			||||||
done
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -55,7 +55,7 @@ state="$(cat "$__object/parameter/state")"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set -- "$@" "$__object_id" "--state" "$state"
 | 
					set -- "$@" "$__object_id" "--state" "$state"
 | 
				
			||||||
cd "$__object/parameter"
 | 
					cd "$__object/parameter"
 | 
				
			||||||
for property in $(ls .); do
 | 
					for property in *; do
 | 
				
			||||||
   if [ "$property" != "type" ] && [ "$property" != "state" ]; then
 | 
					   if [ "$property" != "type" ] && [ "$property" != "state" ]; then
 | 
				
			||||||
      set -- "$@" "--$property" "$(cat "$property")"
 | 
					      set -- "$@" "--$property" "$(cat "$property")"
 | 
				
			||||||
   fi
 | 
					   fi
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -52,7 +52,7 @@ shorten_property() {
 | 
				
			||||||
if [ "$state" = "present" ]; then
 | 
					if [ "$state" = "present" ]; then
 | 
				
			||||||
    cd "$__object/parameter"
 | 
					    cd "$__object/parameter"
 | 
				
			||||||
    if grep -q "^${name}:" "$__object/explorer/passwd"; then
 | 
					    if grep -q "^${name}:" "$__object/explorer/passwd"; then
 | 
				
			||||||
       for property in $(ls .); do
 | 
					       for property in *; do
 | 
				
			||||||
          new_value="$(cat "$property")"
 | 
					          new_value="$(cat "$property")"
 | 
				
			||||||
          unset current_value
 | 
					          unset current_value
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -113,7 +113,7 @@ if [ "$state" = "present" ]; then
 | 
				
			||||||
       fi
 | 
					       fi
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
        echo add >> "$__messages_out"
 | 
					        echo add >> "$__messages_out"
 | 
				
			||||||
        for property in $(ls .); do
 | 
					        for property in *; do
 | 
				
			||||||
            [ "$property" = "state" ] && continue
 | 
					            [ "$property" = "state" ] && continue
 | 
				
			||||||
            [ "$property" = "remove-home" ] && continue
 | 
					            [ "$property" = "remove-home" ] && continue
 | 
				
			||||||
            new_value="$(cat "$property")"
 | 
					            new_value="$(cat "$property")"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue