begin to move parts to cdist-object-gencode
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
		
					parent
					
						
							
								aa72e40d87
							
						
					
				
			
			
				commit
				
					
						1ff135a9d5
					
				
			
		
					 2 changed files with 13 additions and 12 deletions
				
			
		| 
						 | 
				
			
			@ -23,7 +23,7 @@
 | 
			
		|||
#
 | 
			
		||||
 | 
			
		||||
. cdist-config
 | 
			
		||||
[ $# -eq 3 ] || __cdist_usage "<target host>" "<object>" "<type>"
 | 
			
		||||
[ $# -eq 4 ] || __cdist_usage "<target host>" "<object>" "<type>" "<outfile>"
 | 
			
		||||
set -eu
 | 
			
		||||
 | 
			
		||||
__cdist_target_host="$1"; shift
 | 
			
		||||
| 
						 | 
				
			
			@ -45,14 +45,14 @@ export __global="$__cdist_out_dir"
 | 
			
		|||
cd "$__cdist_local_base_dir"
 | 
			
		||||
 | 
			
		||||
if [ -x "$gencode" ]; then
 | 
			
		||||
   cat << eof
 | 
			
		||||
#
 | 
			
		||||
# The following code is imported from output of $gencode
 | 
			
		||||
#    cat << eof
 | 
			
		||||
# #
 | 
			
		||||
# # The following code is imported from output of $gencode
 | 
			
		||||
# #
 | 
			
		||||
# 
 | 
			
		||||
# eof
 | 
			
		||||
 | 
			
		||||
eof
 | 
			
		||||
 | 
			
		||||
   __cdist_exec_fail_on_error "$gencode"
 | 
			
		||||
   __cdist_exec_fail_on_error "$gencode" > "$__cdist_tmp_file"
 | 
			
		||||
else
 | 
			
		||||
   if [ -f "$gencode" ]; then
 | 
			
		||||
      __cdist_exit_err "$gencode exists, but is not executable"
 | 
			
		||||
| 
						 | 
				
			
			@ -61,3 +61,6 @@ else
 | 
			
		|||
   # No gencode? also fine! Ensure we exit 0
 | 
			
		||||
   exit 0
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
chmod u+x "${__cdist_code_local}" "${__cdist_code_remote}"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,14 +32,12 @@ __cdist_object_self="$1"; shift
 | 
			
		|||
__cdist_code_local="$(__cdist_object_code "$__cdist_object_self")-${__cdist_name_gencode_local}"
 | 
			
		||||
__cdist_code_remote="$(__cdist_object_code "$__cdist_object_self")-${__cdist_name_gencode_remote}"
 | 
			
		||||
 | 
			
		||||
# FIXME: check that no file is created if there is no gencode
 | 
			
		||||
# probably move output code to cdist-object-gencode
 | 
			
		||||
__cdist_echo info "Generating local code "
 | 
			
		||||
cdist-object-gencode "$__cdist_target_host" "$__cdist_object_self" \
 | 
			
		||||
   "${__cdist_name_gencode_local}" > "${__cdist_code_local}"
 | 
			
		||||
   "${__cdist_name_gencode_local}" "${__cdist_code_local}"
 | 
			
		||||
 | 
			
		||||
__cdist_echo info "Generating remote code "
 | 
			
		||||
cdist-object-gencode "$__cdist_target_host" "$__cdist_object_self" \
 | 
			
		||||
   "${__cdist_name_gencode_remote}" > "${__cdist_code_remote}"
 | 
			
		||||
   "${__cdist_name_gencode_remote}" "${__cdist_code_remote}"
 | 
			
		||||
 | 
			
		||||
chmod u+x "${__cdist_code_local}" "${__cdist_code_remote}"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue