Finish ugly explorer integration
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
		
					parent
					
						
							
								4450b2f573
							
						
					
				
			
			
				commit
				
					
						16f51ca14d
					
				
			
		
					 5 changed files with 28 additions and 12 deletions
				
			
		| 
						 | 
				
			
			@ -37,10 +37,12 @@
 | 
			
		|||
 | 
			
		||||
# Paths used on the target - must be kind of secure....
 | 
			
		||||
: ${__cdist_remote_base_dir:=/var/lib/cdist}
 | 
			
		||||
: ${__cdist_remote_explorer_dir:=$__cdist_remote_base/explorers}
 | 
			
		||||
: ${__cdist_remote_cache_dir:=$__cdist_remote_base/cache}
 | 
			
		||||
: ${__cdist_remote_cache_explorer:=$__cdist_remote_base/cache}
 | 
			
		||||
: ${__cdist_remote_cache_bin:=$__cdist_remote_base/bin}
 | 
			
		||||
: ${__cdist_remote_explorer_dir:=$__cdist_remote_base_dir/explorers}
 | 
			
		||||
export __cdist_remote_explorer_dir
 | 
			
		||||
: ${__cdist_remote_cache_dir:=$__cdist_remote_base_dir/cache}
 | 
			
		||||
: ${__cdist_remote_cache_explorer:=$__cdist_remote_cache_dir/explorers}
 | 
			
		||||
export __cdist_remote_cache_explorer
 | 
			
		||||
: ${__cdist_remote_cache_bin:=$__cdist_remote_base_dir/bin}
 | 
			
		||||
 | 
			
		||||
# create basedir + tempfile for direct usage
 | 
			
		||||
# FIXME: remove on exit
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -31,5 +31,5 @@ set -e
 | 
			
		|||
export __cdist_target_host="$1"
 | 
			
		||||
export __cdist_source_host="$(cdist_explore_hostname)"
 | 
			
		||||
 | 
			
		||||
. cdist-build "$__cdist_intern_target_host"
 | 
			
		||||
. cdist-remote-exec "$__cdist_intern_target_host"
 | 
			
		||||
. cdist-build "$__cdist_target_host"
 | 
			
		||||
. cdist-remote-exec "$__cdist_target_host"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -21,25 +21,34 @@
 | 
			
		|||
 | 
			
		||||
. cdist-config
 | 
			
		||||
 | 
			
		||||
[ "${__cdist_target_host}" ] || __cdist_usage "Need \$__cdist_target_host setup"
 | 
			
		||||
 | 
			
		||||
set -e
 | 
			
		||||
 | 
			
		||||
# create basedir
 | 
			
		||||
ssh root@${__cdist_target_host} "mkdir -p \"${__cdist_remote_base_dir}\" \
 | 
			
		||||
         \"${__cdist_remote_cache_dir}\" \"${__cdist_remote_cache_bin}\" \
 | 
			
		||||
        \"${__cdist_remote_cache_explorer}\""
 | 
			
		||||
 | 
			
		||||
# Transfer all explorers to the target dir - must be one level above, so
 | 
			
		||||
# coyping it multiple times works: a -> remote:/base/ = remote:/base/a vs.
 | 
			
		||||
# a -> remote:/base/a = remote:/base/a/a (second copy)
 | 
			
		||||
scp -r "${__cdist_explorer_dir}" \
 | 
			
		||||
       "root@${__cdist_target_host}:${__cdist_remote_cache_dir}"
 | 
			
		||||
       "root@${__cdist_target_host}:${__cdist_remote_base_dir}"
 | 
			
		||||
 | 
			
		||||
# Transfer explorer coordinator
 | 
			
		||||
scp "$(which cdist-explorer-coordinator)" \
 | 
			
		||||
# Transfer cdist binaries - FIXME: should transfer all (needed?) of them!
 | 
			
		||||
scp "$(which cdist-explorer-coordinator)" "$(which cdist-config)" \
 | 
			
		||||
    "root@${__cdist_target_host}:${__cdist_remote_cache_bin}"
 | 
			
		||||
 | 
			
		||||
# Execute explorer coordinator, which will save results on target
 | 
			
		||||
ssh root@${__cdist_target_host} "\"${__cdist_remote_cache_bin}/cdist-explorer-coordinator\" \
 | 
			
		||||
ssh root@${__cdist_target_host} \
 | 
			
		||||
   "PATH=\"${__cdist_remote_cache_bin}:\$PATH\"
 | 
			
		||||
   \"${__cdist_remote_cache_bin}/cdist-explorer-coordinator\" \
 | 
			
		||||
         \"${__cdist_remote_explorer_dir}\" \"${__cdist_remote_cache_explorer}\""
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Transfer back all results
 | 
			
		||||
scp -r "root@${__cdist_target_host}:${__cdist_remote_dir}"
 | 
			
		||||
# scp -r "root@${__cdist_target_host}:${__cdist_remote_dir}"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
exit 0
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,3 +33,6 @@ fi
 | 
			
		|||
[ -f /etc/debian_version ] && echo debian
 | 
			
		||||
 | 
			
		||||
[ -f /etc/redhat-release ] && echo redhat
 | 
			
		||||
 | 
			
		||||
# ensure correct exit, otherwise other explorer won't get started
 | 
			
		||||
exit 0
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,7 +19,9 @@
 | 
			
		|||
#
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
case "$(__cdist_explorer_dir/os)" in
 | 
			
		||||
case "$("${__cdist_remote_explorer_dir}/os")" in
 | 
			
		||||
      archlinux) echo pacman ;;
 | 
			
		||||
      debian|ubuntu) echo apt ;;
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
exit 0
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue