begin to cleanup recursive call run

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-02-06 15:52:28 +01:00
parent 5237bcd5cd
commit f4c53e800c
4 changed files with 40 additions and 15 deletions

View File

@ -25,3 +25,7 @@ __cdist_config=$(pwd -P)/conf __cdist_target_host=localhost cdist-explorer-run
# Display result
find conf/cache/hosts/localhost
# Soon working:
cdist-manifest-recursive-run /tmp ~/p/cdist/conf/cache/hosts/localhost/objects

View File

@ -80,9 +80,12 @@ __cdist_bin_prefix="__"
# Used for IDs
__cdist_sane_regexp='[A-Za-z0-9]*[-A-Za-z0-9_]*'
# Used to mark file that created a specific type
# File that contains source of a specific object creation
__cdist_object_source=".source"
# Mark object finished
__cdist_object_finished=".done"
################################################################################
# Function list

View File

@ -43,21 +43,35 @@ __cdist_object_ran_all=0
while [ "$__cdist_object_ran_all" = 0 ]; do
cd "$__cdist_object_dir"
# FIXME past 1.0: allow multi level ids (/example/id instead of example_id only)
# OUTER LOOP NEEDED IF GOING OVER ALL OBJECTS WITH FIND?
for type in *; do
cd "$__cdist_object_dir/$type"
# find all objects (every object has the source recorded)
find . -name "$__cdist_object_source" | \
sed -e "s;$__cdist_object_source\$;;" \
-e 's;^./;;' \
> "$__cdist_tmp_file"
# find all objects (every object has the source recorded)
find . -name "$__cdist_object_source" > "$__cdist_tmp_file"
while read object; do
if [ ! -f "${object}/$__cdist_object_finished" ]; then
echo "Running object ${object} ..."
echo "Merging stuff back..."
touch "${object}/$__cdist_object_finished"
fi
done < "$__cdist_tmp_file"
while read object; do
echo "Running object ${type}/${object} ..."
done < "$__cdist_tmp_file"
done
# FIXME: abort on real case only :-)
__cdist_object_ran_all=1
# # FIXME past 1.0: allow multi level ids (/example/id instead of example_id only)
# # OUTER LOOP NEEDED IF GOING OVER ALL OBJECTS WITH FIND?
# for type in *; do
# cd "$__cdist_object_dir/$type"
#
# # find all objects (every object has the source recorded)
# find . -name "$__cdist_object_source" > "$__cdist_tmp_file"
#
# while read object; do
# echo "Running object ${type}/${object} ..."
# done < "$__cdist_tmp_file"
# done
#
# # FIXME: abort on real case only :-)
# __cdist_object_ran_all=1
done
exit 0

View File

@ -27,7 +27,11 @@ a look at cdist-quickstart(7).
REQUIREMENTS
------------
Cdist requires enabled ssh-server and a posix shell on the clients and
ssh-client and posix shell on the server.
ssh-client and posix shell on the server. Additionaly, it requires
the following unix tools:
- find
-
SEE ALSO