forked from ungleich-public/cdist
discuss todos / cleanup / make more fun for us
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
parent
3618b225a3
commit
5306737d22
6 changed files with 45 additions and 29 deletions
|
@ -68,7 +68,6 @@ __cdist_abs_myname="$__cdist_abs_mydir/$__cdist_myname"
|
||||||
: ${__cdist_name_type:=type}
|
: ${__cdist_name_type:=type}
|
||||||
: ${__cdist_name_type_bin:=type_bin}
|
: ${__cdist_name_type_bin:=type_bin}
|
||||||
: ${__cdist_name_type_explorer:=type_explorer}
|
: ${__cdist_name_type_explorer:=type_explorer}
|
||||||
: ${__cdist_name_objects_created:=objects_created}
|
|
||||||
|
|
||||||
# Used for IDs: Allow everything not starting with - and .
|
# Used for IDs: Allow everything not starting with - and .
|
||||||
: ${__cdist_sane_regexp:=[^-\.].*}
|
: ${__cdist_sane_regexp:=[^-\.].*}
|
||||||
|
@ -109,7 +108,6 @@ __cdist_tmp_file=$(mktemp "$__cdist_tmp_dir/cdist.XXXXXXXXXXXX")
|
||||||
: ${__cdist_manifest_dir:=$__cdist_conf_dir/$__cdist_name_manifest}
|
: ${__cdist_manifest_dir:=$__cdist_conf_dir/$__cdist_name_manifest}
|
||||||
: ${__cdist_manifest_init:=$__cdist_manifest_dir/$__cdist_name_init}
|
: ${__cdist_manifest_init:=$__cdist_manifest_dir/$__cdist_name_init}
|
||||||
: ${__cdist_type_dir:=$__cdist_conf_dir/$__cdist_name_type}
|
: ${__cdist_type_dir:=$__cdist_conf_dir/$__cdist_name_type}
|
||||||
: ${__cdist_new_objects_created:=$__cdist_local_base_dir/$__cdist_name_objects_created}
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Local output
|
# Local output
|
||||||
|
|
|
@ -52,10 +52,9 @@ if [ -f "$__cdist_manifest" ]; then
|
||||||
export $__cdist_name_var_type="$(__cdist_type_dir "$__cdist_type")"
|
export $__cdist_name_var_type="$(__cdist_type_dir "$__cdist_type")"
|
||||||
|
|
||||||
cdist-manifest-run "$__cdist_target_host" "$__cdist_manifest"
|
cdist-manifest-run "$__cdist_target_host" "$__cdist_manifest"
|
||||||
# Tell cdist that there may be new objects
|
FIXME: Tell cdist that there may be new objects - WHO? Mama?
|
||||||
touch "$__cdist_new_objects_created"
|
touch "$__cdist_new_objects_created"
|
||||||
else
|
else
|
||||||
__cdist_exit_err "${__cdist_manifest} needs to be executable."
|
__cdist_exit_err "${__cdist_manifest} needs to be executable."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,7 @@ if [ ! -f "$__cdist_object_finished" ]; then
|
||||||
# Check if type of object has >= 1 explorer
|
# Check if type of object has >= 1 explorer
|
||||||
__cdist_has_explorer="$(__cdist_type_has_explorer "$__cdist_type")"
|
__cdist_has_explorer="$(__cdist_type_has_explorer "$__cdist_type")"
|
||||||
|
|
||||||
|
FIXME: put into cdist-object-explorer-run
|
||||||
# Run the type explorers for the current object if any
|
# Run the type explorers for the current object if any
|
||||||
if [ "$__cdist_has_explorer" ]; then
|
if [ "$__cdist_has_explorer" ]; then
|
||||||
if ! grep -q "$__cdist_type" "$__cdist_types_pushed"; then
|
if ! grep -q "$__cdist_type" "$__cdist_types_pushed"; then
|
||||||
|
|
|
@ -30,6 +30,9 @@ __cdist_target_host="$1"; shift
|
||||||
|
|
||||||
__cdist_objects="$__cdist_tmp_dir/objects"
|
__cdist_objects="$__cdist_tmp_dir/objects"
|
||||||
|
|
||||||
|
FIXME: reuse in subscripts, save in objects_base_dir
|
||||||
|
export __cdist_objects_created="$__cdist_tmp_dir/objects_created"
|
||||||
|
|
||||||
# Loop until we do not create new objects anymore
|
# Loop until we do not create new objects anymore
|
||||||
# which is equal to all objects have been run
|
# which is equal to all objects have been run
|
||||||
touch "$__cdist_new_objects_created"
|
touch "$__cdist_new_objects_created"
|
||||||
|
@ -48,11 +51,13 @@ while [ -f "$__cdist_new_objects_created" ]; do
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
__cdist_object="$1"; shift
|
__cdist_object="$1"; shift
|
||||||
|
|
||||||
|
FIXME: migrate into cdist-object-run
|
||||||
|
FIXME: take care of SSH foo after migration in while loop
|
||||||
__cdist_object_require="$(__cdist_object_require "$__cdist_object")"
|
__cdist_object_require="$(__cdist_object_require "$__cdist_object")"
|
||||||
if [ -f "$__cdist_object_require" ]; then
|
if [ -f "$__cdist_object_require" ]; then
|
||||||
echo
|
echo
|
||||||
while read __cdist_requirement; do
|
while read __cdist_requirement; do
|
||||||
echo "Resolving dependency $__cdist_object -> $__cdist_requirement ..."
|
echo "Resolving dependency $__cdist_requirement for $__cdist_object ..."
|
||||||
cdist-object-run "$__cdist_target_host" "$__cdist_requirement"
|
cdist-object-run "$__cdist_target_host" "$__cdist_requirement"
|
||||||
done < "$__cdist_object_require"
|
done < "$__cdist_object_require"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
/ prefix all internal variables with __cdist! -> Nico
|
||||||
|
|
||||||
Cache:
|
Cache:
|
||||||
- add example how to use
|
- add example how to use
|
||||||
- export variable $__cache
|
- export variable $__cache
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
- check: echo without parameters == valid in posix? bin/cdist-object-run:45 and others
|
x check: echo without parameters == valid in posix? bin/cdist-object-run:45 and others
|
||||||
- align messages (already in todo for steven, but makes life much easier, thus repeated)
|
x bin/cdist-object-run-all: "->" graphic: can be useful, but if -> consistent!
|
||||||
- advantage of touch/rm loop vs. y == variable? bin/cdist-object-run-all
|
|
||||||
also in bin/cdist-object-run
|
|
||||||
- bin/cdist-object-run-all: "->" graphic: can be useful, but if -> consistent!
|
|
||||||
-> all graphics could look cool:
|
-> all graphics could look cool:
|
||||||
|
|
||||||
Object foo
|
Object foo
|
||||||
|
@ -12,36 +9,50 @@
|
||||||
|
|
||||||
but maybe bad do parse from outside
|
but maybe bad do parse from outside
|
||||||
|
|
||||||
- bin/cdist-object-run: type_explorer stuff: probably put into own binary
|
x advantage of touch/rm loop vs. y == variable? bin/cdist-object-run-all
|
||||||
- sounds like cdist-object-explorer-run is already the right executable to
|
also in bin/cdist-object-run
|
||||||
place such stuff into
|
-> cool :-)
|
||||||
|
x remove enormous amount of empty lines :-)
|
||||||
- remove enormous amount of empty lines :-)
|
|
||||||
- at end of file
|
- at end of file
|
||||||
- between [ $# -eq 2 ] || and set
|
- between [ $# -eq 2 ] || and set
|
||||||
- after if
|
- after if
|
||||||
- before fi
|
- before fi
|
||||||
|
|
||||||
|
x code aus cdist-object-run-all für requirements:
|
||||||
|
in cdist-object-requirements oder so auslagern?
|
||||||
|
cdist-object-run-all wäre dann eine schöne zwei-zeiler-schleife
|
||||||
|
|
||||||
|
x cdist-object-explorer-run and bin/cdist-object-run seem to contain
|
||||||
|
very very similar code regarding transfer and co.
|
||||||
|
-> indirect solved by moving code into cdist-object-explorer-run
|
||||||
|
|
||||||
|
x cdist-object-manifest-run:
|
||||||
|
# Tell cdist that there may be new objects -> WHO? :-)
|
||||||
|
|
||||||
|
x general: cdist-object-run-all looks like a good idea!
|
||||||
|
|
||||||
|
- export $__cdist_name_var_self=$__cdist_object_self -> non core
|
||||||
|
|
||||||
|
- bin/cdist-object-run: type_explorer stuff: probably put into own binary
|
||||||
|
- sounds like cdist-object-explorer-run is already the right executable to
|
||||||
|
place such stuff into
|
||||||
|
|
||||||
- cdist-type-explorer-push: wherefore if [ -d "$src_dir" ];?
|
- cdist-type-explorer-push: wherefore if [ -d "$src_dir" ];?
|
||||||
-> does this not even hide bugs?
|
-> does this not even hide bugs?
|
||||||
-> not sure whether covering cdist-dir in its own script makes
|
-> not sure whether covering cdist-dir in its own script makes
|
||||||
sense, as cdist-dir push is only a one liner
|
sense, as cdist-dir push is only a one liner
|
||||||
-> if cdist-dir does too less, enhance it
|
-> if cdist-dir does too less, enhance it
|
||||||
|
=> merge into cdist-object-explorer-run
|
||||||
|
|
||||||
- code aus cdist-object-run-all für requirements:
|
- marker for type transferred / pushed goes into out/type/
|
||||||
in cdist-object-requirements oder so auslagern?
|
-> new variables for out/type
|
||||||
cdist-object-run-all wäre dann eine schöne zwei-zeiler-schleife
|
-> new variables for out/type/.MARKERFOONAMEMEGOOD
|
||||||
|
|
||||||
- try to prefix all internal variables with __cdist!
|
- new function: __cdist_type_explorer_created $name
|
||||||
- only avoid if waayyyyyyyyyyy tooooooooo long
|
if ! -d foo -> mkdir foo, echo $name >> foo/$NEW_FANCY_VAR
|
||||||
- f.i.: cdist-object-explorer-run
|
|
||||||
|
|
||||||
- cdist-object-explorer-run and bin/cdist-object-run seem to contain
|
|
||||||
very very similar code regarding transfer and co.
|
|
||||||
|
|
||||||
- cdist-object-manifest-run:
|
|
||||||
# Tell cdist that there may be new objects -> WHO? :-)
|
|
||||||
|
|
||||||
- general: cdist-object-run-all looks like a good idea!
|
|
||||||
|
|
||||||
|
|
||||||
|
- align messages (already in todo for steven, but makes life much easier, thus repeated)
|
||||||
|
-> prefix all object stuff with $__self
|
||||||
|
-> __cdist_echo object string
|
||||||
|
-> $__cdist_object_self :-)
|
||||||
|
|
Loading…
Reference in a new issue