forked from ungleich-public/cdist
		
	begin to cleanup recursive call run
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
		
					parent
					
						
							
								5237bcd5cd
							
						
					
				
			
			
				commit
				
					
						f4c53e800c
					
				
			
		
					 4 changed files with 40 additions and 15 deletions
				
			
		| 
						 | 
				
			
			@ -25,3 +25,7 @@ __cdist_config=$(pwd -P)/conf __cdist_target_host=localhost cdist-explorer-run
 | 
			
		|||
 | 
			
		||||
# Display result
 | 
			
		||||
find conf/cache/hosts/localhost
 | 
			
		||||
 | 
			
		||||
# Soon working:
 | 
			
		||||
cdist-manifest-recursive-run /tmp ~/p/cdist/conf/cache/hosts/localhost/objects
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -80,9 +80,12 @@ __cdist_bin_prefix="__"
 | 
			
		|||
# Used for IDs
 | 
			
		||||
__cdist_sane_regexp='[A-Za-z0-9]*[-A-Za-z0-9_]*'
 | 
			
		||||
 | 
			
		||||
# Used to mark file that created a specific type
 | 
			
		||||
# File that contains source of a specific object creation
 | 
			
		||||
__cdist_object_source=".source"
 | 
			
		||||
 | 
			
		||||
# Mark object finished
 | 
			
		||||
__cdist_object_finished=".done"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
# Function list
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -43,21 +43,35 @@ __cdist_object_ran_all=0
 | 
			
		|||
while [ "$__cdist_object_ran_all" = 0 ]; do
 | 
			
		||||
   cd "$__cdist_object_dir"
 | 
			
		||||
 | 
			
		||||
   # FIXME past 1.0: allow multi level ids (/example/id instead of example_id only)
 | 
			
		||||
   # OUTER LOOP NEEDED IF GOING OVER ALL OBJECTS WITH FIND?
 | 
			
		||||
   for type in *; do
 | 
			
		||||
      cd "$__cdist_object_dir/$type"
 | 
			
		||||
 | 
			
		||||
   # find all objects (every object has the source recorded)
 | 
			
		||||
      find . -name "$__cdist_object_source" > "$__cdist_tmp_file"
 | 
			
		||||
   find . -name "$__cdist_object_source" |   \
 | 
			
		||||
      sed -e "s;$__cdist_object_source\$;;"  \
 | 
			
		||||
          -e 's;^./;;'                       \
 | 
			
		||||
      > "$__cdist_tmp_file"
 | 
			
		||||
 | 
			
		||||
   while read object; do
 | 
			
		||||
         echo "Running object ${type}/${object} ..."
 | 
			
		||||
      if [ ! -f "${object}/$__cdist_object_finished" ]; then
 | 
			
		||||
         echo "Running object ${object} ..."
 | 
			
		||||
         echo "Merging stuff back..."
 | 
			
		||||
         touch "${object}/$__cdist_object_finished"
 | 
			
		||||
      fi
 | 
			
		||||
   done < "$__cdist_tmp_file"
 | 
			
		||||
   done
 | 
			
		||||
 | 
			
		||||
   # FIXME: abort on real case only :-)
 | 
			
		||||
   __cdist_object_ran_all=1
 | 
			
		||||
#    # FIXME past 1.0: allow multi level ids (/example/id instead of example_id only)
 | 
			
		||||
#    # OUTER LOOP NEEDED IF GOING OVER ALL OBJECTS WITH FIND?
 | 
			
		||||
#    for type in *; do
 | 
			
		||||
#       cd "$__cdist_object_dir/$type"
 | 
			
		||||
# 
 | 
			
		||||
#       # find all objects (every object has the source recorded)
 | 
			
		||||
#       find . -name "$__cdist_object_source" > "$__cdist_tmp_file"
 | 
			
		||||
# 
 | 
			
		||||
#       while read object; do
 | 
			
		||||
#          echo "Running object ${type}/${object} ..."
 | 
			
		||||
#       done < "$__cdist_tmp_file"
 | 
			
		||||
#    done
 | 
			
		||||
#    
 | 
			
		||||
#    # FIXME: abort on real case only :-)
 | 
			
		||||
#    __cdist_object_ran_all=1
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
exit 0
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -27,7 +27,11 @@ a look at cdist-quickstart(7).
 | 
			
		|||
REQUIREMENTS
 | 
			
		||||
------------
 | 
			
		||||
Cdist requires enabled ssh-server and a posix shell on the clients and
 | 
			
		||||
ssh-client and posix shell on the server.
 | 
			
		||||
ssh-client and posix shell on the server. Additionaly, it requires
 | 
			
		||||
the following unix tools:
 | 
			
		||||
 | 
			
		||||
- find
 | 
			
		||||
- 
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
SEE ALSO
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue