Merge remote branch 'nico/master'
This commit is contained in:
commit
1e42861ff4
26 changed files with 590 additions and 279 deletions
|
@ -1,50 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org)
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
#
|
||||
# Exec code locally and remote
|
||||
#
|
||||
|
||||
. cdist-config
|
||||
[ $# -eq 1 ] || __cdist_usage "<target host>"
|
||||
set -e
|
||||
|
||||
__cdist_target_host="$1"; shift
|
||||
|
||||
__cdist_object_list "$__cdist_out_object_dir" > "$__cdist_tmp_file"
|
||||
|
||||
# NEED TO CREATE ARRAY, SSH DESTROYS WHILE READ LOOP
|
||||
while read object; do
|
||||
set -- "$@" "$object"
|
||||
done < "$__cdist_tmp_file"
|
||||
|
||||
while [ $# -ge 1 ]; do
|
||||
object="$1"; shift
|
||||
|
||||
# Code local
|
||||
export __cdist_out_object_dir="$__cdist_out_object_dir"
|
||||
cdist-code-run "$object" "${__cdist_name_gencode_local}" \
|
||||
|| __cdist_exit_err "Local code failed for $object"
|
||||
|
||||
# Code remote
|
||||
cdist-run-remote "$__cdist_target_host" \
|
||||
"export __cdist_out_object_dir=\"$__cdist_remote_out_object_base_dir\";" \
|
||||
"cdist-code-run" "$object" "${__cdist_name_gencode_remote}" \
|
||||
|| __cdist_exit_err "Remote code failed for $object"
|
||||
done < "$__cdist_tmp_file"
|
|
@ -133,7 +133,7 @@ __cdist_tmp_file=$(mktemp "$__cdist_tmp_dir/cdist.XXXXXXXXXXXX")
|
|||
#
|
||||
: ${__cdist_remote_out_dir:=$__cdist_remote_base_dir/$__cdist_name_out_dir}
|
||||
: ${__cdist_remote_out_explorer_dir:=$__cdist_remote_out_dir/$__cdist_name_explorer}
|
||||
: ${__cdist_remote_out_object_base_dir:=$__cdist_remote_out_dir/$__cdist_name_object}
|
||||
: ${__cdist_remote_out_object_dir:=$__cdist_remote_out_dir/$__cdist_name_object}
|
||||
|
||||
################################################################################
|
||||
# Internal functions
|
||||
|
@ -256,9 +256,14 @@ __cdist_object_type_explorer_dir()
|
|||
# Remote
|
||||
#
|
||||
|
||||
__cdist_remote_object_base_dir()
|
||||
{
|
||||
echo "${__cdist_remote_out_object_dir}/$1"
|
||||
}
|
||||
|
||||
__cdist_remote_object_dir()
|
||||
{
|
||||
echo "${__cdist_remote_out_object_base_dir}/$1"
|
||||
echo "$(__cdist_remote_object_base_dir "$1")/${__cdist_name_dot_cdist}"
|
||||
}
|
||||
|
||||
__cdist_remote_object_parameter_dir()
|
||||
|
|
|
@ -50,14 +50,7 @@ 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-manifest-run-all "$__cdist_target_host"
|
||||
cdist-object-explorer-all "$__cdist_target_host"
|
||||
cdist-object-gencode-all "$__cdist_target_host"
|
||||
|
||||
echo "Transferring objects to $__cdist_target_host ..."
|
||||
cdist-dir push "$__cdist_target_host" "$__cdist_out_object_dir" \
|
||||
"${__cdist_remote_out_object_base_dir}"
|
||||
|
||||
cdist-code-run-all "$__cdist_target_host"
|
||||
cdist-object-run-all "$__cdist_target_host"
|
||||
cdist-cache "$__cdist_target_host"
|
||||
|
||||
echo "cdist $__cdist_version: Successfully finished run on $__cdist_target_host"
|
||||
|
|
42
bin/cdist-object-code-run
Executable file
42
bin/cdist-object-code-run
Executable file
|
@ -0,0 +1,42 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# 2010-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/>.
|
||||
#
|
||||
#
|
||||
# Exec the code for the given object locally and remote
|
||||
#
|
||||
|
||||
. cdist-config
|
||||
[ $# -eq 2 ] || __cdist_usage "<target host> <object>"
|
||||
set -e
|
||||
|
||||
__cdist_target_host="$1"; shift
|
||||
__cdist_object="$1"; shift
|
||||
|
||||
# Code local
|
||||
export __cdist_out_object_dir="$__cdist_out_object_dir"
|
||||
cdist-code-run "$__cdist_object" "${__cdist_name_gencode_local}" \
|
||||
|| __cdist_exit_err "Local code failed for $__cdist_object"
|
||||
|
||||
# Code remote
|
||||
cdist-run-remote "$__cdist_target_host" \
|
||||
"export __cdist_out_object_dir=\"$__cdist_remote_out_object_dir\";" \
|
||||
"cdist-code-run" "$__cdist_object" "${__cdist_name_gencode_remote}" \
|
||||
|| __cdist_exit_err "Remote code failed for $__cdist_object"
|
||||
|
|
@ -1,102 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# 2011 Nico Schottelius (nico-cdist at schottelius.org)
|
||||
#
|
||||
# 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 each created object check the explorers and run them if needed.
|
||||
#
|
||||
|
||||
. cdist-config
|
||||
[ $# -eq 1 ] || __cdist_usage "<target host>"
|
||||
set -eu
|
||||
|
||||
__cdist_target_host="$1"; shift
|
||||
|
||||
object_listing="$__cdist_tmp_dir/objects"
|
||||
type_listing_all="$__cdist_tmp_dir/types_all"
|
||||
type_listing="$__cdist_tmp_dir/types"
|
||||
|
||||
# Get listing of objects
|
||||
__cdist_object_list "$__cdist_out_object_dir" > "$object_listing"
|
||||
|
||||
# Get listing of types used
|
||||
while read object; do
|
||||
echo "$(__cdist_type_from_object "$object")" >> "$type_listing_all"
|
||||
done < "$object_listing"
|
||||
sort "$type_listing_all" | uniq > "$type_listing"
|
||||
|
||||
# Create pseudo array to avoid issues with ssh
|
||||
tc=0
|
||||
while read type; do
|
||||
eval type_$tc=\"\$type\"
|
||||
tc=$((tc+1))
|
||||
done < "$type_listing"
|
||||
|
||||
# For every type that has explorers, Transfer the explorers
|
||||
i=0
|
||||
while [ "$i" -lt "$tc" ]; do
|
||||
eval cur_type=\"\$type_$i\"
|
||||
|
||||
src_dir="$(__cdist_type_explorer_dir "$cur_type")"
|
||||
dst_dir="$(__cdist_remote_type_explorer_dir "$cur_type")"
|
||||
|
||||
if [ -d "$src_dir" ]; then
|
||||
cdist-dir push "$__cdist_target_host" "$src_dir" "$dst_dir"
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
|
||||
################################################################################
|
||||
# Explorer execution per object
|
||||
#
|
||||
# need to create pseudo array, as ssh in cdist-explorer-run will destroy while-read loops
|
||||
while read object; do
|
||||
set -- "$@" "$object"
|
||||
done < "$object_listing"
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
__object="$1"; shift
|
||||
__object_id="$(__cdist_object_id_from_object "$__object")"
|
||||
__cdist_type="$(__cdist_type_from_object "$__object")"
|
||||
|
||||
# Check if type of object has >= 1 explorer
|
||||
has_explorer="$(__cdist_type_has_explorer "$__cdist_type")"
|
||||
|
||||
# If so, run explorers on remote side
|
||||
if [ "$has_explorer" ]; then
|
||||
echo "Running explorers for $__object ..."
|
||||
# Copy object parameters
|
||||
cdist-dir push "$__cdist_target_host" \
|
||||
"$(__cdist_object_parameter_dir "$__object")" \
|
||||
"$(__cdist_remote_object_parameter_dir "$__object")"
|
||||
|
||||
# Execute explorers
|
||||
cdist-run-remote "$__cdist_target_host" \
|
||||
"__object=\"$(__cdist_remote_object_dir "$__object")\"" \
|
||||
"__object_id=\"$__object_id\"" \
|
||||
cdist-remote-explorer-run \
|
||||
"$__cdist_name_var_type_explorer" \
|
||||
"$(__cdist_remote_type_explorer_dir "$__cdist_type")" \
|
||||
"$(__cdist_remote_object_type_explorer_dir "$__object")"
|
||||
|
||||
# Copy back results
|
||||
cdist-dir pull "$__cdist_target_host" \
|
||||
"$(__cdist_remote_object_type_explorer_dir "$__object")" \
|
||||
"$(__cdist_object_type_explorer_dir "$__object")"
|
||||
fi
|
||||
done
|
61
bin/cdist-object-explorer-run
Executable file
61
bin/cdist-object-explorer-run
Executable file
|
@ -0,0 +1,61 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# 2010-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/>.
|
||||
#
|
||||
#
|
||||
# Run the explorers for the given object on the target host.
|
||||
#
|
||||
|
||||
. cdist-config
|
||||
[ $# -eq 2 ] || __cdist_usage "<target host> <object>"
|
||||
|
||||
set -eu
|
||||
|
||||
__cdist_target_host="$1"; shift
|
||||
__object="$1"; shift
|
||||
|
||||
__object_id="$(__cdist_object_id_from_object "$__object")"
|
||||
__cdist_type="$(__cdist_type_from_object "$__object")"
|
||||
|
||||
# Check if type of object has >= 1 explorer
|
||||
has_explorer="$(__cdist_type_has_explorer "$__cdist_type")"
|
||||
|
||||
# If so, run explorers on remote side
|
||||
if [ "$has_explorer" ]; then
|
||||
echo "Running explorers for $__object ..."
|
||||
# Copy object parameters
|
||||
cdist-dir push "$__cdist_target_host" \
|
||||
"$(__cdist_object_parameter_dir "$__object")" \
|
||||
"$(__cdist_remote_object_parameter_dir "$__object")"
|
||||
|
||||
# Execute explorers
|
||||
cdist-run-remote "$__cdist_target_host" \
|
||||
"__object=\"$(__cdist_remote_object_dir "$__object")\"" \
|
||||
"__object_id=\"$__object_id\"" \
|
||||
cdist-remote-explorer-run \
|
||||
"$__cdist_name_var_type_explorer" \
|
||||
"$(__cdist_remote_type_explorer_dir "$__cdist_type")" \
|
||||
"$(__cdist_remote_object_type_explorer_dir "$__object")"
|
||||
|
||||
# Copy back results
|
||||
cdist-dir pull "$__cdist_target_host" \
|
||||
"$(__cdist_remote_object_type_explorer_dir "$__object")" \
|
||||
"$(__cdist_object_type_explorer_dir "$__object")"
|
||||
fi
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# 2010 Nico Schottelius (nico-cdist at schottelius.org)
|
||||
# 2011 Steven Armstrong (steven-cdist at armstrong.cc)
|
||||
#
|
||||
# This file is part of cdist.
|
||||
#
|
||||
|
@ -18,28 +19,26 @@
|
|||
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#
|
||||
# For each created object create the code to be executed on the target.
|
||||
# For the given object create the code to be executed on the target.
|
||||
#
|
||||
|
||||
. cdist-config
|
||||
[ $# -eq 1 ] || __cdist_usage "<target host>"
|
||||
[ $# -eq 2 ] || __cdist_usage "<target host> <object>"
|
||||
set -eu
|
||||
|
||||
__cdist_target_host="$1"; shift
|
||||
__cdist_object="$1"; shift
|
||||
|
||||
__cdist_object_list "$__cdist_out_object_dir" > "$__cdist_tmp_file"
|
||||
code_local="$(__cdist_object_code "$__cdist_object")-${__cdist_name_gencode_local}"
|
||||
code_remote="$(__cdist_object_code "$__cdist_object")-${__cdist_name_gencode_remote}"
|
||||
|
||||
while read object; do
|
||||
code_local="$(__cdist_object_code "$object")-${__cdist_name_gencode_local}"
|
||||
code_remote="$(__cdist_object_code "$object")-${__cdist_name_gencode_remote}"
|
||||
|
||||
echo "Generating local code for $object ..."
|
||||
cdist-object-gencode "$__cdist_target_host" "$object" \
|
||||
echo "Generating local code for $__cdist_object ..."
|
||||
cdist-object-gencode "$__cdist_target_host" "$__cdist_object" \
|
||||
"${__cdist_name_gencode_local}" > "${code_local}"
|
||||
|
||||
echo "Generating remote code for $object ..."
|
||||
cdist-object-gencode "$__cdist_target_host" "$object" \
|
||||
echo "Generating remote code for $__cdist_object ..."
|
||||
cdist-object-gencode "$__cdist_target_host" "$__cdist_object" \
|
||||
"${__cdist_name_gencode_remote}" > "${code_remote}"
|
||||
|
||||
chmod u+x "${code_local}" "${code_remote}"
|
||||
done < "$__cdist_tmp_file"
|
||||
chmod u+x "${code_local}" "${code_remote}"
|
||||
|
37
bin/cdist-object-push
Executable file
37
bin/cdist-object-push
Executable file
|
@ -0,0 +1,37 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# 2010 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/>.
|
||||
#
|
||||
#
|
||||
# Transfer the given object to the target host.
|
||||
#
|
||||
|
||||
. cdist-config
|
||||
[ $# -eq 2 ] || __cdist_usage "<target host> <object>"
|
||||
set -eu
|
||||
|
||||
__cdist_target_host="$1"; shift
|
||||
__cdist_object="$1"; shift
|
||||
|
||||
|
||||
echo "Transferring object $__cdist_object to target host ..."
|
||||
cdist-dir push "$__cdist_target_host" \
|
||||
"$(__cdist_object_dir "$__cdist_object")" \
|
||||
"$(__cdist_remote_object_dir "$__cdist_object")"
|
||||
|
55
bin/cdist-object-run
Executable file
55
bin/cdist-object-run
Executable file
|
@ -0,0 +1,55 @@
|
|||
#!/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
|
||||
# - generate code
|
||||
# - copy object to target
|
||||
# - execute code on target
|
||||
#
|
||||
|
||||
. cdist-config
|
||||
[ $# -eq 2 ] || __cdist_usage "<target host> <object>"
|
||||
set -eu
|
||||
|
||||
__cdist_target_host="$1"; shift
|
||||
__cdist_object="$1"; shift
|
||||
|
||||
|
||||
__cdist_type="$(__cdist_type_from_object "$__cdist_object")"
|
||||
|
||||
# Check if type of object has >= 1 explorer
|
||||
__cdist_has_explorer="$(__cdist_type_has_explorer "$__cdist_type")"
|
||||
|
||||
# Run the type explorers for the current object if any
|
||||
if [ "$__cdist_has_explorer" ]; then
|
||||
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" "$__cdist_object"
|
||||
|
||||
# Transfer the current object to the target
|
||||
cdist-object-push "$__cdist_target_host" "$__cdist_object"
|
||||
|
||||
# Run the code for the current object
|
||||
cdist-object-code-run "$__cdist_target_host" "$__cdist_object"
|
||||
|
65
bin/cdist-object-run-all
Executable file
65
bin/cdist-object-run-all
Executable file
|
@ -0,0 +1,65 @@
|
|||
#!/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/>.
|
||||
#
|
||||
#
|
||||
# Run cdist-object-run for each created object.
|
||||
#
|
||||
|
||||
. cdist-config
|
||||
[ $# -eq 1 ] || __cdist_usage "<target host>"
|
||||
set -eu
|
||||
|
||||
__cdist_target_host="$1"; shift
|
||||
|
||||
__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" > "$__cdist_objects"
|
||||
|
||||
|
||||
# NEED TO CREATE ARRAY, SSH DESTROYS WHILE READ LOOP
|
||||
while read __cdist_object; do
|
||||
set -- "$@" "$__cdist_object"
|
||||
done < "$__cdist_objects"
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
__cdist_object="$1"; shift
|
||||
|
||||
__cdist_type="$(__cdist_type_from_object "$__cdist_object")"
|
||||
|
||||
# Check if type of object has >= 1 explorer
|
||||
__cdist_has_explorer="$(__cdist_type_has_explorer "$__cdist_type")"
|
||||
|
||||
# Transfer the type explorers if any
|
||||
if [ "$__cdist_has_explorer" ]; then
|
||||
if ! grep -q "$__cdist_type" "$__cdist_types_pushed"; then
|
||||
cdist-type-explorer-push "$__cdist_target_host" "$__cdist_type"
|
||||
echo "$__cdist_type" >> "$__cdist_types_pushed"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Process the given object
|
||||
cdist-object-run "$__cdist_target_host" "$__cdist_object"
|
||||
|
||||
done
|
||||
|
|
@ -57,16 +57,16 @@ for explorer in "$__cdist_explorer_dir/"*; do
|
|||
|
||||
if [ -f "$explorer" ]; then
|
||||
if [ ! -x "$explorer" ]; then
|
||||
echo "Explorer \"$explorer\" exists, but is not executable."
|
||||
continue
|
||||
echo "Explorer \"$explorer\" exists, but is not executable." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Execute explorers and save results in remote destination directory
|
||||
"$explorer" > "${__cdist_my_out_dir}/$explorer_name"
|
||||
else
|
||||
if [ -e "$explorer" ]; then
|
||||
echo "Explorer \"$explorer\" exists, but is not a file."
|
||||
continue
|
||||
echo "Explorer \"$explorer\" exists, but is not a file." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
|
40
bin/cdist-type-explorer-push
Executable file
40
bin/cdist-type-explorer-push
Executable file
|
@ -0,0 +1,40 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# 2010-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/>.
|
||||
#
|
||||
#
|
||||
# Push the given types explorers to the target host
|
||||
#
|
||||
|
||||
. cdist-config
|
||||
[ $# -eq 2 ] || __cdist_usage "<target host> <type>"
|
||||
|
||||
set -eu
|
||||
|
||||
__cdist_target_host="$1"; shift
|
||||
__cdist_type="$1"; shift
|
||||
|
||||
src_dir="$(__cdist_type_explorer_dir "$__cdist_type")"
|
||||
dst_dir="$(__cdist_remote_type_explorer_dir "$__cdist_type")"
|
||||
|
||||
if [ -d "$src_dir" ]; then
|
||||
echo "Transfering explorers for $__cdist_type ..."
|
||||
cdist-dir push "$__cdist_target_host" "$src_dir" "$dst_dir"
|
||||
fi
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
if [ -f "$__object/parameter/name" ]; then
|
||||
name="$(cat "$__object/parameter/name")"
|
||||
else
|
||||
name="$__object_id"
|
||||
name="/$__object_id"
|
||||
fi
|
||||
|
||||
pgrep -x -f "$name" || true
|
||||
|
|
14
doc/dev/logs/2011-03-28.execution-order
Normal file
14
doc/dev/logs/2011-03-28.execution-order
Normal file
|
@ -0,0 +1,14 @@
|
|||
run global explorers
|
||||
run init manitest
|
||||
|
||||
run all objects
|
||||
-> depencies aufloesen wie/was/wo ????????
|
||||
run object
|
||||
run explorer
|
||||
run manifest
|
||||
-> object liste wird evt veraendert
|
||||
run gencode
|
||||
run push -> target
|
||||
run exec code
|
||||
|
||||
|
16
doc/dev/todo/steven
Normal file
16
doc/dev/todo/steven
Normal file
|
@ -0,0 +1,16 @@
|
|||
- document object_id=$1 for manifest + gencode :-)
|
||||
|
||||
- update docs regarding flow in cdist-stages.text
|
||||
- create man pages for new executables
|
||||
- nuke legacy manpages
|
||||
|
||||
- prettify output of cdist-deploy-to, e.g.
|
||||
|
||||
Processing object __file/etc/cdist-configured
|
||||
transfering type explorers ...
|
||||
running type explorers ...
|
||||
running manifest ...
|
||||
running gencode ...
|
||||
transfering object to target ...
|
||||
running code ...
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
cdist-code-run-all(1)
|
||||
=====================
|
||||
Nico Schottelius <nico-cdist--@--schottelius.org>
|
||||
|
||||
|
||||
NAME
|
||||
----
|
||||
cdist-code-run-all - Execute all generated code on the target
|
||||
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
cdist-code-run-all HOSTNAME
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
cdist-code-run-all is just a wrapper for cdist-remote-code-run-all.
|
||||
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
- cdist(7)
|
||||
- cdist-deploy-to(1)
|
||||
- cdist-remote-code-run-all(1)
|
||||
- cdist-run-remote(1)
|
||||
|
||||
|
||||
COPYING
|
||||
-------
|
||||
Copyright \(C) 2011 Nico Schottelius. Free use of this software is
|
||||
granted under the terms of the GNU General Public License version 3 (GPLv3).
|
33
doc/man/cdist-object-code-run.text
Normal file
33
doc/man/cdist-object-code-run.text
Normal file
|
@ -0,0 +1,33 @@
|
|||
cdist-object-code-run(1)
|
||||
========================
|
||||
Nico Schottelius <nico-cdist--@--schottelius.org>
|
||||
Steven Armstrong <steven-dist--@--armstrong.cc>
|
||||
|
||||
|
||||
NAME
|
||||
----
|
||||
cdist-object-code-run - Execute the generated code for a object
|
||||
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
cdist-object-code-run HOSTNAME OBJECT
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
Execute the local and remote code for the given object.
|
||||
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
- cdist(7)
|
||||
- cdist-object-run-all(1)
|
||||
- cdist-code-run(1)
|
||||
- cdist-run-remote(1)
|
||||
|
||||
|
||||
COPYING
|
||||
-------
|
||||
Copyright \(C) 2011 Nico Schottelius, Steven Armstrong. Free use of this software is
|
||||
granted under the terms of the GNU General Public License version 3 (GPLv3).
|
|
@ -1,33 +0,0 @@
|
|||
cdist-object-explorer-all(1)
|
||||
============================
|
||||
Nico Schottelius <nico-cdist--@--schottelius.org>
|
||||
|
||||
|
||||
NAME
|
||||
----
|
||||
cdist-object-explorer-all - Run type explorer for every object
|
||||
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
cdist-object-explorer-all HOSTNAME
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
For every object, it checks whether the type has one or more explorers.
|
||||
If so, the explorers of the type are copied to the target and executed
|
||||
once per object.
|
||||
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
- cdist(7)
|
||||
- cdist-deploy-to(1)
|
||||
- cdist-remote-explorer-run(1)
|
||||
|
||||
|
||||
COPYING
|
||||
-------
|
||||
Copyright \(C) 2011 Nico Schottelius. Free use of this software is
|
||||
granted under the terms of the GNU General Public License version 3 (GPLv3).
|
32
doc/man/cdist-object-explorer-run.text
Normal file
32
doc/man/cdist-object-explorer-run.text
Normal file
|
@ -0,0 +1,32 @@
|
|||
cdist-object-explorer-run(1)
|
||||
============================
|
||||
Nico Schottelius <nico-cdist--@--schottelius.org>
|
||||
Steven Armstrong <steven-dist--@--armstrong.cc>
|
||||
|
||||
|
||||
NAME
|
||||
----
|
||||
cdist-object-explorer-run - Run type explorers for a object
|
||||
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
cdist-object-explorer-run HOSTNAME OBJECT
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
Runs the explorers for the given object on the target host.
|
||||
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
- cdist(7)
|
||||
- cdist-deploy-to(1)
|
||||
- cdist-remote-explorer-run(1)
|
||||
|
||||
|
||||
COPYING
|
||||
-------
|
||||
Copyright \(C) 2011 Nico Schottelius, Steven Armstrong. Free use of this software is
|
||||
granted under the terms of the GNU General Public License version 3 (GPLv3).
|
|
@ -1,32 +0,0 @@
|
|||
cdist-object-gencode-all(1)
|
||||
===========================
|
||||
Nico Schottelius <nico-cdist--@--schottelius.org>
|
||||
|
||||
|
||||
NAME
|
||||
----
|
||||
cdist-object-gencode-all - Generate code for every existing object
|
||||
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
cdist-object-gencode-all HOSTNAME
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
For every object that exists, the cdist-object-gencode is executed.
|
||||
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
- cdist(7)
|
||||
- cdist-code-run(1)
|
||||
- cdist-deploy-to(1)
|
||||
- cdist-object-gencode(1)
|
||||
|
||||
|
||||
COPYING
|
||||
-------
|
||||
Copyright \(C) 2011 Nico Schottelius. Free use of this software is
|
||||
granted under the terms of the GNU General Public License version 3 (GPLv3).
|
33
doc/man/cdist-object-gencode-run.text
Normal file
33
doc/man/cdist-object-gencode-run.text
Normal file
|
@ -0,0 +1,33 @@
|
|||
cdist-object-gencode-run(1)
|
||||
===========================
|
||||
Nico Schottelius <nico-cdist--@--schottelius.org>
|
||||
Steven Armstrong <steven-dist--@--armstrong.cc>
|
||||
|
||||
|
||||
NAME
|
||||
----
|
||||
cdist-object-gencode-run - Generate code for a object
|
||||
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
cdist-object-gencode-run HOSTNAME OBJECT
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
For the given object, generate the code for local and remote execution.
|
||||
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
- cdist(7)
|
||||
- cdist-code-run(1)
|
||||
- cdist-object-run-all(1)
|
||||
- cdist-object-gencode(1)
|
||||
|
||||
|
||||
COPYING
|
||||
-------
|
||||
Copyright \(C) 2011 Nico Schottelius, Steven Armstrong. Free use of this software is
|
||||
granted under the terms of the GNU General Public License version 3 (GPLv3).
|
32
doc/man/cdist-object-push.text
Normal file
32
doc/man/cdist-object-push.text
Normal file
|
@ -0,0 +1,32 @@
|
|||
cdist-object-push(1)
|
||||
====================
|
||||
Nico Schottelius <nico-cdist--@--schottelius.org>
|
||||
Steven Armstrong <steven-dist--@--armstrong.cc>
|
||||
|
||||
|
||||
NAME
|
||||
----
|
||||
cdist-object-push - Transfer a object to the target host
|
||||
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
cdist-object-push HOSTNAME OBJECT
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
Transfers the given object to the target host.
|
||||
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
- cdist(7)
|
||||
- cdist-object-run-all(1)
|
||||
- cdist-type(1)
|
||||
|
||||
|
||||
COPYING
|
||||
-------
|
||||
Copyright \(C) 2011 Nico Schottelius, Steven Armstrong. Free use of this software is
|
||||
granted under the terms of the GNU General Public License version 3 (GPLv3).
|
34
doc/man/cdist-object-run-all.text
Normal file
34
doc/man/cdist-object-run-all.text
Normal file
|
@ -0,0 +1,34 @@
|
|||
cdist-object-run-all(1)
|
||||
=======================
|
||||
Nico Schottelius <nico-cdist--@--schottelius.org>
|
||||
Steven Armstrong <steven-dist--@--armstrong.cc>
|
||||
|
||||
|
||||
NAME
|
||||
----
|
||||
cdist-object-run-all - Run all created objects on the target host
|
||||
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
cdist-object-run-all HOSTNAME
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
Transfers type explorers to the target then runs cdist-object-run(1)
|
||||
for each created object.
|
||||
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
- cdist(7)
|
||||
- cdist-type-explorer-push(1)
|
||||
- cdist-object-run(1)
|
||||
- cdist-type(1)
|
||||
|
||||
|
||||
COPYING
|
||||
-------
|
||||
Copyright \(C) 2011 Nico Schottelius, Steven Armstrong. Free use of this software is
|
||||
granted under the terms of the GNU General Public License version 3 (GPLv3).
|
37
doc/man/cdist-object-run.text
Normal file
37
doc/man/cdist-object-run.text
Normal file
|
@ -0,0 +1,37 @@
|
|||
cdist-object-run(1)
|
||||
===================
|
||||
Nico Schottelius <nico-cdist--@--schottelius.org>
|
||||
Steven Armstrong <steven-dist--@--armstrong.cc>
|
||||
|
||||
|
||||
NAME
|
||||
----
|
||||
cdist-object-run - Run an object
|
||||
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
cdist-object-run HOSTNAME OBJECT
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
Runs the given object on the given target host.
|
||||
The different subtasks are dispatched to specialized exectuables.
|
||||
See related man pages for details.
|
||||
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
- cdist(7)
|
||||
- cdist-object-explorer-run(1)
|
||||
- cdist-object-gencode-run(1)
|
||||
- cdist-object-push(1)
|
||||
- cdist-object-code-run(1)
|
||||
- cdist-type(1)
|
||||
|
||||
|
||||
COPYING
|
||||
-------
|
||||
Copyright \(C) 2011 Nico Schottelius, Steven Armstrong. Free use of this software is
|
||||
granted under the terms of the GNU General Public License version 3 (GPLv3).
|
|
@ -22,7 +22,7 @@ It ensures PATH is setup correctly on the target side.
|
|||
SEE ALSO
|
||||
--------
|
||||
- cdist(7)
|
||||
- cdist-code-run-all(1)
|
||||
- cdist-object-code-run(1)
|
||||
- cdist-deploy-to(1)
|
||||
- cdist-remote-code-run-all(1)
|
||||
|
||||
|
|
32
doc/man/cdist-type-explorer-push.text
Normal file
32
doc/man/cdist-type-explorer-push.text
Normal file
|
@ -0,0 +1,32 @@
|
|||
cdist-type-explorer-push(1)
|
||||
===========================
|
||||
Nico Schottelius <nico-cdist--@--schottelius.org>
|
||||
Steven Armstrong <steven-dist--@--armstrong.cc>
|
||||
|
||||
|
||||
NAME
|
||||
----
|
||||
cdist-type-explorer-push - Transfer type explorers to the target host
|
||||
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
cdist-type-explorer-push HOSTNAME TYPE
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
Transfers the explorers of the given type to the target host.
|
||||
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
- cdist(7)
|
||||
- cdist-object-run(1)
|
||||
- cdist-type(1)
|
||||
|
||||
|
||||
COPYING
|
||||
-------
|
||||
Copyright \(C) 2011 Nico Schottelius, Steven Armstrong. Free use of this software is
|
||||
granted under the terms of the GNU General Public License version 3 (GPLv3).
|
Loading…
Reference in a new issue