forked from ungleich-public/cdist
prefix all variables with __cdist_
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
parent
4e2d063911
commit
bdf3e4b86e
1 changed files with 17 additions and 17 deletions
|
@ -32,49 +32,49 @@ set -eu
|
|||
|
||||
__cdist_target_host="$1"; shift
|
||||
|
||||
object_listing="$__cdist_tmp_dir/objects"
|
||||
types_pushed="$__cdist_tmp_dir/types_pushed"
|
||||
touch "$types_pushed"
|
||||
__cdist_objects="$__cdist_tmp_dir/objects"
|
||||
__cdist_types_pushed="$__cdist_tmp_dir/types_pushed"
|
||||
touch "$__cdist_types_pushed"
|
||||
|
||||
|
||||
# Get listing of objects
|
||||
__cdist_object_list "$__cdist_out_object_dir" > "$object_listing"
|
||||
__cdist_object_list "$__cdist_out_object_dir" > "$__cdist_objects"
|
||||
|
||||
|
||||
# NEED TO CREATE ARRAY, SSH DESTROYS WHILE READ LOOP
|
||||
while read object; do
|
||||
set -- "$@" "$object"
|
||||
done < "$object_listing"
|
||||
while read __cdist_object; do
|
||||
set -- "$@" "$__cdist_object"
|
||||
done < "$__cdist_objects"
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
object="$1"; shift
|
||||
__cdist_object="$1"; shift
|
||||
|
||||
__cdist_type="$(__cdist_type_from_object "$object")"
|
||||
__cdist_type="$(__cdist_type_from_object "$__cdist_object")"
|
||||
|
||||
# Check if type of object has >= 1 explorer
|
||||
has_explorer="$(__cdist_type_has_explorer "$__cdist_type")"
|
||||
__cdist_has_explorer="$(__cdist_type_has_explorer "$__cdist_type")"
|
||||
|
||||
# If so, run explorers on remote side
|
||||
if [ "$has_explorer" ]; then
|
||||
if [ "$__cdist_has_explorer" ]; then
|
||||
# Transfer the type explorers
|
||||
if ! grep -q "$__cdist_type" "$types_pushed"; then
|
||||
if ! grep -q "$__cdist_type" "$__cdist_types_pushed"; then
|
||||
cdist-type-explorer-push "$__cdist_target_host" "$__cdist_type"
|
||||
echo "$__cdist_type" >> "$types_pushed"
|
||||
echo "$__cdist_type" >> "$__cdist_types_pushed"
|
||||
fi
|
||||
|
||||
# Run the type explorers for the current object
|
||||
cdist-object-explorer-run "$__cdist_target_host" "$object"
|
||||
cdist-object-explorer-run "$__cdist_target_host" "$__cdist_object"
|
||||
|
||||
fi
|
||||
|
||||
# Run the gencode scripts for the current object
|
||||
cdist-object-gencode-run "$__cdist_target_host" "$object"
|
||||
cdist-object-gencode-run "$__cdist_target_host" "$__cdist_object"
|
||||
|
||||
# Transfer the current object to the target
|
||||
cdist-object-push "$__cdist_target_host" "$object"
|
||||
cdist-object-push "$__cdist_target_host" "$__cdist_object"
|
||||
|
||||
# Run the code for the current object
|
||||
cdist-object-code-run "$__cdist_target_host" "$object"
|
||||
cdist-object-code-run "$__cdist_target_host" "$__cdist_object"
|
||||
|
||||
done
|
||||
|
||||
|
|
Loading…
Reference in a new issue