integrate cdist-cache
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
		
					parent
					
						
							
								8f88ed2691
							
						
					
				
			
			
				commit
				
					
						a9ce26f968
					
				
			
		
					 4 changed files with 12 additions and 33 deletions
				
			
		
							
								
								
									
										9
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										9
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -2,13 +2,8 @@
 | 
			
		|||
.*.swp
 | 
			
		||||
 | 
			
		||||
# Ignore generated manpages
 | 
			
		||||
doc/man/*.[1-9]
 | 
			
		||||
doc/man/.marker
 | 
			
		||||
doc/man/man*/
 | 
			
		||||
 | 
			
		||||
doc/html
 | 
			
		||||
 | 
			
		||||
conf/type/*/*.7
 | 
			
		||||
conf/type/*/man.html
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Ignore cache for version control
 | 
			
		||||
cache/
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,34 +23,15 @@
 | 
			
		|||
#
 | 
			
		||||
 | 
			
		||||
. cdist-config
 | 
			
		||||
[ $# -eq 2 ] || __cdist_usage "<target host> <manifest>"
 | 
			
		||||
[ $# -eq 1 ] || __cdist_usage "<target host>"
 | 
			
		||||
set -u
 | 
			
		||||
 | 
			
		||||
__cdist_target_host="$1"; shift
 | 
			
		||||
__cdist_manifest="$1"; shift
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
# Export information for cdist-type-emulator or manifest
 | 
			
		||||
#
 | 
			
		||||
mkdir -p "${__cdist_local_base_cache_dir}"
 | 
			
		||||
__cdist_abs_cache_dir="$(cd "$__cdist_local_base_cache_dir" && pwd -P)"
 | 
			
		||||
__cdist_abs_ddir="$__cdist_abs_cache_dir/$__cdist_target_host"
 | 
			
		||||
 | 
			
		||||
# Config dir should not get reset - FIXME: why did I do this?
 | 
			
		||||
export __cdist_conf_dir
 | 
			
		||||
 | 
			
		||||
# Used to record the source in the object
 | 
			
		||||
export __cdist_manifest
 | 
			
		||||
 | 
			
		||||
# Export information for manifests - __cdist_out_dir comes from cdist-config
 | 
			
		||||
export __global="$__cdist_out_dir"
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
# The actual run
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
# Ensure binaries exist and are up-to-date
 | 
			
		||||
cdist-type-build-emulation "${__cdist_out_type_bin_dir}" \
 | 
			
		||||
   || __cdist_exit_err "Failed to build type emulation binaries"
 | 
			
		||||
 | 
			
		||||
# prepend our path, so all cdist tools come before other tools
 | 
			
		||||
export PATH="${__cdist_out_type_bin_dir}:$PATH"
 | 
			
		||||
 | 
			
		||||
__cdist_exec_fail_on_error "${__cdist_manifest}"
 | 
			
		||||
echo "Saving cache to $__cdist_abs_ddir ..."
 | 
			
		||||
rm -rf "$__cdist_abs_ddir"
 | 
			
		||||
mv "$__cdist_local_base_dir" "$__cdist_abs_ddir"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -41,6 +41,7 @@ __cdist_abs_myname="$__cdist_abs_mydir/$__cdist_myname"
 | 
			
		|||
#
 | 
			
		||||
 | 
			
		||||
: ${__cdist_name_bin:=bin}
 | 
			
		||||
: ${__cdist_name_cache:=cache}
 | 
			
		||||
: ${__cdist_name_code:=code}
 | 
			
		||||
: ${__cdist_name_code_finished:=codedone}
 | 
			
		||||
: ${__cdist_name_conf_dir:=conf}
 | 
			
		||||
| 
						 | 
				
			
			@ -100,6 +101,7 @@ __cdist_tmp_file=$(mktemp "$__cdist_tmp_dir/cdist.XXXXXXXXXXXX")
 | 
			
		|||
# Local Base
 | 
			
		||||
# 
 | 
			
		||||
: ${__cdist_local_base_dir:=$__cdist_tmp_dir}
 | 
			
		||||
: ${__cdist_local_base_cache_dir:=$__cdist_abs_mydir/../$__cdist_name_cache}
 | 
			
		||||
 | 
			
		||||
: ${__cdist_conf_dir:="$(cd "$__cdist_abs_mydir/../conf" && pwd -P)"}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -58,5 +58,6 @@ cdist-dir push "$__cdist_target_host" "$__cdist_out_object_dir" \
 | 
			
		|||
   "${__cdist_remote_out_object_base_dir}"
 | 
			
		||||
 | 
			
		||||
cdist-code-run-all            "$__cdist_target_host"
 | 
			
		||||
cdist-cache                   "$__cdist_target_host"
 | 
			
		||||
 | 
			
		||||
echo "cdist $__cdist_version: Successfully finished run on $__cdist_target_host"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue