forked from ungleich-public/cdist
split explorer/manifest and gencode runcode into to 2 steps
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
parent
d85af22ce3
commit
61b7b68671
5 changed files with 62 additions and 9 deletions
|
@ -55,6 +55,7 @@ __cdist_abs_myname="$__cdist_abs_mydir/$__cdist_myname"
|
|||
: ${__cdist_name_manifest:=manifest}
|
||||
: ${__cdist_name_object:=object}
|
||||
: ${__cdist_name_object_finished:=done}
|
||||
: ${__cdist_name_object_processed:=processed}
|
||||
: ${__cdist_name_object_id:=object_id}
|
||||
: ${__cdist_name_object_source:=source}
|
||||
: ${__cdist_name_objects_created:=.objects_created}
|
||||
|
@ -194,6 +195,11 @@ __cdist_object_code()
|
|||
echo "$(__cdist_object_dir "$1")/${__cdist_name_code}"
|
||||
}
|
||||
|
||||
__cdist_object_processed()
|
||||
{
|
||||
echo "$(__cdist_object_dir "$1")/${__cdist_name_object_processed}"
|
||||
}
|
||||
|
||||
__cdist_object_finished()
|
||||
{
|
||||
echo "$(__cdist_object_dir "$1")/${__cdist_name_object_finished}"
|
||||
|
|
|
@ -49,7 +49,8 @@ cdist-dir push "$__cdist_target_host" "${__cdist_abs_mydir}" "${__cdist_remote_b
|
|||
|
||||
cdist-explorer-run-global "$__cdist_target_host"
|
||||
cdist-manifest-run-init "$__cdist_target_host"
|
||||
cdist-object-run-all "$__cdist_target_host"
|
||||
cdist-object-all "$__cdist_target_host" cdist-object-process
|
||||
cdist-object-all "$__cdist_target_host" cdist-object-run
|
||||
cdist-cache "$__cdist_target_host"
|
||||
|
||||
echo "cdist $__cdist_version: Successfully finished run on $__cdist_target_host"
|
||||
|
|
|
@ -19,14 +19,15 @@
|
|||
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#
|
||||
# Run cdist-object-run for each created object.
|
||||
# Run the given command for each created object.
|
||||
#
|
||||
|
||||
. cdist-config
|
||||
[ $# -eq 1 ] || __cdist_usage "<target host>"
|
||||
[ $# -eq 2 ] || __cdist_usage "<target host> <command>"
|
||||
set -eu
|
||||
|
||||
__cdist_target_host="$1"; shift
|
||||
__cdist_command="$1"; shift
|
||||
|
||||
__cdist_objects="$__cdist_tmp_dir/objects"
|
||||
|
||||
|
@ -47,7 +48,6 @@ while [ -f "$__cdist_objects_created" ]; do
|
|||
|
||||
while [ $# -gt 0 ]; do
|
||||
__cdist_object="$1"; shift
|
||||
# Process the object
|
||||
cdist-object-run "$__cdist_target_host" "$__cdist_object"
|
||||
$__cdist_command "$__cdist_target_host" "$__cdist_object"
|
||||
done
|
||||
done
|
48
bin/cdist-object-process
Executable file
48
bin/cdist-object-process
Executable file
|
@ -0,0 +1,48 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# 2011 Nico Schottelius (nico-cdist at schottelius.org)
|
||||
# 2011 Steven Armstrong (steven-cdist at armstrong.cc)
|
||||
#
|
||||
# This file is part of cdist.
|
||||
#
|
||||
# cdist is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# cdist is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#
|
||||
# For the given object:
|
||||
# - run type explorers
|
||||
# - run type manifest
|
||||
#
|
||||
|
||||
. cdist-config
|
||||
[ $# -eq 2 ] || __cdist_usage "<target host> <object>"
|
||||
set -eu
|
||||
|
||||
__cdist_target_host="$1"; shift
|
||||
__cdist_object="$1"; shift
|
||||
__cdist_object_dir="$(__cdist_object_dir "$__cdist_object")"
|
||||
[ -d "$__cdist_object_dir" ] || __cdist_exit_err "Requested object is not defined: $__cdist_object"
|
||||
|
||||
# Export to non-core for use in manifest and gencode scripts
|
||||
export $__cdist_name_var_self=$__cdist_object
|
||||
|
||||
__cdist_object_processed="$(__cdist_object_processed "$__cdist_object")"
|
||||
if [ ! -f "$__cdist_object_processed" ]; then
|
||||
echo
|
||||
echo "Processing object $__cdist_object"
|
||||
cdist-object-explorer-run "$__cdist_target_host" "$__cdist_object"
|
||||
cdist-object-manifest-run "$__cdist_target_host" "$__cdist_object"
|
||||
|
||||
# Mark this object as done
|
||||
touch "$__cdist_object_processed"
|
||||
fi
|
|
@ -39,8 +39,6 @@ __cdist_object_dir="$(__cdist_object_dir "$__cdist_object")"
|
|||
# Export to non-core for use in manifest and gencode scripts
|
||||
export $__cdist_name_var_self=$__cdist_object
|
||||
|
||||
__cdist_type="$(__cdist_type_from_object "$__cdist_object")"
|
||||
|
||||
__cdist_object_finished="$(__cdist_object_finished "$__cdist_object")"
|
||||
if [ ! -f "$__cdist_object_finished" ]; then
|
||||
|
||||
|
@ -62,8 +60,8 @@ if [ ! -f "$__cdist_object_finished" ]; then
|
|||
|
||||
echo
|
||||
echo "Running object $__cdist_object"
|
||||
cdist-object-explorer-run "$__cdist_target_host" "$__cdist_object"
|
||||
cdist-object-manifest-run "$__cdist_target_host" "$__cdist_object"
|
||||
#cdist-object-explorer-run "$__cdist_target_host" "$__cdist_object"
|
||||
#cdist-object-manifest-run "$__cdist_target_host" "$__cdist_object"
|
||||
cdist-object-gencode-run "$__cdist_target_host" "$__cdist_object"
|
||||
cdist-object-push "$__cdist_target_host" "$__cdist_object"
|
||||
cdist-object-code-run "$__cdist_target_host" "$__cdist_object"
|
||||
|
|
Loading…
Reference in a new issue