forked from ungleich-public/cdist
in theory: do not generate code anymore
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
parent
93ef73a645
commit
fc01ceb914
|
@ -34,32 +34,35 @@ __cdist_object_dir="$(__cdist_object_dir "$__cdist_object_self")"
|
||||||
__cdist_type="$(__cdist_type_from_object "$__cdist_object_self")"
|
__cdist_type="$(__cdist_type_from_object "$__cdist_object_self")"
|
||||||
__cdist_object_id="$(__cdist_object_id_from_object "$__cdist_object_self")"
|
__cdist_object_id="$(__cdist_object_id_from_object "$__cdist_object_self")"
|
||||||
__cdist_code_output="$(__cdist_object_code "$__cdist_object_self" "$__cdist_gencode_type")"
|
__cdist_code_output="$(__cdist_object_code "$__cdist_object_self" "$__cdist_gencode_type")"
|
||||||
gencode="$(__cdist_type_gencode "$__cdist_type" "$__cdist_gencode_type")"
|
__cdist_type_gencode="$(__cdist_type_gencode "$__cdist_type" "$__cdist_gencode_type")"
|
||||||
|
|
||||||
# export variables for gencode
|
# export variables for gencode
|
||||||
export __object_id="$__cdist_object_id"
|
export __object_id="$__cdist_object_id"
|
||||||
export __object="$__cdist_object_dir"
|
export __object="$__cdist_object_dir"
|
||||||
export __global="$__cdist_out_dir"
|
export __global="$__cdist_out_dir"
|
||||||
|
|
||||||
|
# FIXME Needed?
|
||||||
cd "$__cdist_local_base_dir"
|
cd "$__cdist_local_base_dir"
|
||||||
|
|
||||||
if [ -x "$gencode" ]; then
|
if [ -x "$__cdist_type_gencode" ]; then
|
||||||
# cat << eof
|
|
||||||
# #
|
|
||||||
# # The following code is imported from output of $gencode
|
|
||||||
# #
|
|
||||||
#
|
|
||||||
# eof
|
|
||||||
|
|
||||||
__cdist_exec_fail_on_error "$gencode" > "$__cdist_tmp_file"
|
__cdist_exec_fail_on_error "$gencode" > "$__cdist_tmp_file"
|
||||||
else
|
else
|
||||||
if [ -f "$gencode" ]; then
|
if [ -f "$__cdist_type_gencode" ]; then
|
||||||
__cdist_exit_err "$gencode exists, but is not executable"
|
__cdist_exit_err "$__cdist_type_gencode exists, but is not executable"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# No gencode? also fine! Ensure we exit 0
|
# Ensure it's empty, if there is no gencode
|
||||||
exit 0
|
: > "$__cdist_tmp_file"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chmod u+x "${__cdist_code_local}" "${__cdist_code_remote}"
|
# Only create code, if gencode created output
|
||||||
|
if [ "$(wc -l < "$__cdist_tmp_file")" -gt 0 ]; then
|
||||||
|
cat - "$__cdist_tmp_file" << eof > "$__cdist_code_output"
|
||||||
|
#
|
||||||
|
# The following code was generated by $__cdist_type_gencode
|
||||||
|
#
|
||||||
|
|
||||||
|
eof
|
||||||
|
chmod u+x "${__cdist_code_output}"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
|
@ -29,15 +29,10 @@ set -eu
|
||||||
__cdist_target_host="$1"; shift
|
__cdist_target_host="$1"; shift
|
||||||
__cdist_object_self="$1"; shift
|
__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}"
|
|
||||||
|
|
||||||
__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_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}"
|
||||||
|
|
||||||
chmod u+x "${__cdist_code_local}" "${__cdist_code_remote}"
|
|
||||||
|
|
Loading…
Reference in a new issue