forked from ungleich-public/cdist
		
	use while read -> avoids ifs problem
Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
This commit is contained in:
		
					parent
					
						
							
								ce0f779664
							
						
					
				
			
			
				commit
				
					
						a126bd955f
					
				
			
		
					 1 changed files with 6 additions and 10 deletions
				
			
		| 
						 | 
					@ -71,21 +71,17 @@ _cksum() {
 | 
				
			||||||
   echo "$1" | cksum | cut -d' ' -f 1
 | 
					   echo "$1" | cksum | cut -d' ' -f 1
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Add each key
 | 
					while read key; do
 | 
				
			||||||
IFS=$'\n'
 | 
					   cksum_key="$(_cksum "$key")"
 | 
				
			||||||
for key in $(cat "$__object/parameter/key"); do
 | 
					 | 
				
			||||||
   unset IFS
 | 
					 | 
				
			||||||
   raw_key="$(echo "$key" | tr ' ' '\n' | awk '/^ssh-(rsa|dsa)/ {printf $1" ";getline;printf $1}')"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
   cksum_key="$(_cksum "$raw_key")"
 | 
					 | 
				
			||||||
   line_id="${owner}-${cksum_key}"
 | 
					   line_id="${owner}-${cksum_key}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   set -- "$line_id"
 | 
					   set -- "$line_id"
 | 
				
			||||||
   set -- "$@" --file "$file"
 | 
					   set -- "$@" --file "$file"
 | 
				
			||||||
   set -- "$@" --regex ".*$raw_key.*"
 | 
					   set -- "$@" --regex ".*$key.*"
 | 
				
			||||||
   if [ "$state" = 'present' ]; then
 | 
					   if [ "$state" = 'present' ]; then
 | 
				
			||||||
      set -- "$@" --line "$key"
 | 
					      set -- "$@" --line "$key"
 | 
				
			||||||
   fi
 | 
					   fi
 | 
				
			||||||
   set -- "$@" --state "$state"
 | 
					   set -- "$@" --state "$state"
 | 
				
			||||||
   require="__block/$__object_name" __line "$@"
 | 
					   # Ensure __line does not read stdin
 | 
				
			||||||
done
 | 
					   require="__block/$__object_name" __line "$@" < /dev/null
 | 
				
			||||||
 | 
					done < "$__object/parameter/key"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue