begin to move parts to cdist-object-gencode

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-04-28 14:37:33 +02:00
parent aa72e40d87
commit 1ff135a9d5
2 changed files with 13 additions and 12 deletions

View file

@ -23,7 +23,7 @@
# #
. cdist-config . cdist-config
[ $# -eq 3 ] || __cdist_usage "<target host>" "<object>" "<type>" [ $# -eq 4 ] || __cdist_usage "<target host>" "<object>" "<type>" "<outfile>"
set -eu set -eu
__cdist_target_host="$1"; shift __cdist_target_host="$1"; shift
@ -45,14 +45,14 @@ export __global="$__cdist_out_dir"
cd "$__cdist_local_base_dir" cd "$__cdist_local_base_dir"
if [ -x "$gencode" ]; then if [ -x "$gencode" ]; then
cat << eof # cat << eof
# # #
# The following code is imported from output of $gencode # # The following code is imported from output of $gencode
# # #
#
# eof
eof __cdist_exec_fail_on_error "$gencode" > "$__cdist_tmp_file"
__cdist_exec_fail_on_error "$gencode"
else else
if [ -f "$gencode" ]; then if [ -f "$gencode" ]; then
__cdist_exit_err "$gencode exists, but is not executable" __cdist_exit_err "$gencode exists, but is not executable"
@ -61,3 +61,6 @@ else
# No gencode? also fine! Ensure we exit 0 # No gencode? also fine! Ensure we exit 0
exit 0 exit 0
fi fi
chmod u+x "${__cdist_code_local}" "${__cdist_code_remote}"

View file

@ -32,14 +32,12 @@ __cdist_object_self="$1"; shift
__cdist_code_local="$(__cdist_object_code "$__cdist_object_self")-${__cdist_name_gencode_local}" __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}" __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_echo info "Generating local code "
cdist-object-gencode "$__cdist_target_host" "$__cdist_object_self" \ 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_echo info "Generating remote code "
cdist-object-gencode "$__cdist_target_host" "$__cdist_object_self" \ 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}" chmod u+x "${__cdist_code_local}" "${__cdist_code_remote}"