From 5a7ffff077e8b5ac7ab6ade908c40a134c1a992b Mon Sep 17 00:00:00 2001
From: Nico Schottelius <nico@kr.ethz.ch>
Date: Wed, 23 Feb 2011 19:25:41 +0100
Subject: [PATCH 1/7] document bug

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
---
 bin/cdist-deploy-to | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/cdist-deploy-to b/bin/cdist-deploy-to
index b6203409..c4fb2289 100755
--- a/bin/cdist-deploy-to
+++ b/bin/cdist-deploy-to
@@ -46,7 +46,7 @@ cdist-explorer-run-init       "$__cdist_target_host" "$__cdist_out_explorer_dir"
 # Create initial object base
 cdist-manifest-init           "$__cdist_target_host" "$__cdist_out_object_dir"
 
-# Create dependent objects
+# Create dependent objects - BUG: does not abort on error in manifest!!!!
 cdist-manifest-run-all        "$__cdist_target_host" "$__cdist_out_object_dir"
 
 exit 2

From 57c60a40a8e4a4db29b204434de9b594ebe313e8 Mon Sep 17 00:00:00 2001
From: Nico Schottelius <nico@kr.ethz.ch>
Date: Thu, 24 Feb 2011 09:37:31 +0100
Subject: [PATCH 2/7] make cdist-manifest-run change the working dir

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
---
 bin/cdist-manifest-init    |  3 ++-
 bin/cdist-manifest-run     | 10 ++++++----
 bin/cdist-manifest-run-all |  8 ++------
 3 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/bin/cdist-manifest-init b/bin/cdist-manifest-init
index 2b9ae00b..9e8a346f 100755
--- a/bin/cdist-manifest-init
+++ b/bin/cdist-manifest-init
@@ -29,4 +29,5 @@ set -e
 export __cdist_target_host="$1"; shift
 export __cdist_output_dir="$1"; shift
 
-cdist-manifest-run "$__cdist_target_host" "$__cdist_manifest_init" "$__cdist_output_dir"
+cdist-manifest-run "$__cdist_target_host" "$__cdist_local_base_dir" \
+   "$__cdist_manifest_init" "$__cdist_output_dir"
diff --git a/bin/cdist-manifest-run b/bin/cdist-manifest-run
index 48990edb..892b3a2f 100755
--- a/bin/cdist-manifest-run
+++ b/bin/cdist-manifest-run
@@ -23,12 +23,13 @@
 #
 
 . cdist-config
-[ $# -ge 3 ] || __cdist_usage "<target host> <manifest> <outdir> [manifest arguments]"
+[ $# -ge 4 ] || __cdist_usage "<target host> <work dir> <manifest> <out dir> [manifest arguments]"
 set -u
 
-export __cdist_target_host="$1"; shift
-export __cdist_manifest="$1"; shift
-export __cdist_output_dir="$1"; shift
+__cdist_target_host="$1"; shift
+__cdist_work_dir="$1"; shift
+__cdist_manifest="$1"; shift
+__cdist_output_dir="$1"; shift
 
 # Ensure binaries exist and are up-to-date
 cdist-type-build-emulation || __cdist_exit_err "Failed to build type emulation binaries"
@@ -43,4 +44,5 @@ fi
 
 mkdir -p "${__cdist_output_dir}" || __cdist_exit_err "Cannot create output dir ${__cdist_output_dir}"
 
+cd "$__cdist_work_dir" || __cdist_exit_err "Cannot change to work dir \"$__cdist_work_dir\"."
 __cdist_exec_fail_on_error "${__cdist_manifest}" "$@"
diff --git a/bin/cdist-manifest-run-all b/bin/cdist-manifest-run-all
index 038b0dc9..ad49bbb4 100755
--- a/bin/cdist-manifest-run-all
+++ b/bin/cdist-manifest-run-all
@@ -65,12 +65,8 @@ while [ "$__cdist_new_objects_created" = "y"  ]; do
          if [ -x "${__cdist_manifest}" ]; then
             echo "Executing manifest ${__cdist_manifest} ..."
 
-            # Safely change directory, convienent for type-writers
-            (
-               cd "$__cdist_cur_object_dir"
-               cdist-manifest-run "$__cdist_target_host" "$__cdist_manifest"     \
-                                  "$__cdist_new_objects_dir" "$__cdist_object_id"
-            )
+            cdist-manifest-run "$__cdist_target_host" "$__cdist_cur_object_dir" \
+               "$__cdist_manifest" "$__cdist_new_objects_dir" "$__cdist_object_id"
 
             __cdist_object_list "${__cdist_new_objects_dir}" > "$__cdist_new_objects_list"
 

From 2b9acf9f2609b56c2fe8d866621f383fbe24f9d3 Mon Sep 17 00:00:00 2001
From: Nico Schottelius <nico@kr.ethz.ch>
Date: Thu, 24 Feb 2011 09:41:42 +0100
Subject: [PATCH 3/7] adjust issue manifest not to hide error if file is
 missing

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
---
 conf/types/__issue/manifest | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/conf/types/__issue/manifest b/conf/types/__issue/manifest
index d38aeb92..45c3bd98 100755
--- a/conf/types/__issue/manifest
+++ b/conf/types/__issue/manifest
@@ -20,8 +20,9 @@
 #
 
 destination=/etc/issue
+os="$(cat "out/explorers/os")"
 
-case "$(cat "out/explorers/os")" in
+case "$os" in
    archlinux)
       source="$(pwd -P)/files/archlinux"
    ;;

From 3af305b1fc396e99b86506a16c0608adffa39c81 Mon Sep 17 00:00:00 2001
From: Nico Schottelius <nico@kr.ethz.ch>
Date: Thu, 24 Feb 2011 09:41:53 +0100
Subject: [PATCH 4/7] -debug in cdist-manifest-run-all

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
---
 bin/cdist-manifest-run-all | 1 -
 1 file changed, 1 deletion(-)

diff --git a/bin/cdist-manifest-run-all b/bin/cdist-manifest-run-all
index ad49bbb4..5d21b70c 100755
--- a/bin/cdist-manifest-run-all
+++ b/bin/cdist-manifest-run-all
@@ -60,7 +60,6 @@ while [ "$__cdist_new_objects_created" = "y"  ]; do
 
          __cdist_type="$(__cdist_type_from_object "$__cdist_object")"
          __cdist_manifest="$__cdist_type_dir/${__cdist_type}/${__cdist_name_manifest}"
-         echo $__cdist_manifest
 
          if [ -x "${__cdist_manifest}" ]; then
             echo "Executing manifest ${__cdist_manifest} ..."

From 6e6643d9d1f110d4694628c03e89b9ac7675cd08 Mon Sep 17 00:00:00 2001
From: Nico Schottelius <nico@kr.ethz.ch>
Date: Thu, 24 Feb 2011 10:01:31 +0100
Subject: [PATCH 5/7] --todo

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
---
 doc/dev/todo/niconext | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext
index d6a7e77e..099464f1 100644
--- a/doc/dev/todo/niconext
+++ b/doc/dev/todo/niconext
@@ -1,6 +1 @@
 add explorers per type/object
-   - create clean trees locally and remote
-      - define paths in cdist-config
-   - rewrite cdist-explorer-run
-      - define helpers on the remote side (like cdist-explorer-coordinator)
-         - make cdist-config available / put helpers into path

From 06ce87a289b5d181881642b2c37ef2f49604a84a Mon Sep 17 00:00:00 2001
From: Nico Schottelius <nico@kr.ethz.ch>
Date: Thu, 24 Feb 2011 10:06:56 +0100
Subject: [PATCH 6/7] begin to cleanup bin/cdist-object-explorer-all

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
---
 bin/cdist-deploy-to           |  4 +++-
 bin/cdist-object-explorer-all | 17 +++++++++++++++++
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/bin/cdist-deploy-to b/bin/cdist-deploy-to
index c4fb2289..88b7aaf9 100755
--- a/bin/cdist-deploy-to
+++ b/bin/cdist-deploy-to
@@ -49,9 +49,11 @@ cdist-manifest-init           "$__cdist_target_host" "$__cdist_out_object_dir"
 # Create dependent objects - BUG: does not abort on error in manifest!!!!
 cdist-manifest-run-all        "$__cdist_target_host" "$__cdist_out_object_dir"
 
+# Run explorer of each type for every object of types with explorer
+cdist-object-explorer-all     "$__cdist_target_host" "$__cdist_out_object_dir"
+
 exit 2
 
-cdist-object-explorer-all     "$__cdist_target_host" "$__cdist_out_object_dir"
 cdist-object-codegen-all      "$__cdist_target_host" "$__cdist_out_object_dir" "$__cdist_out_execs"
 cdist-exec-transfer           "$__cdist_target_host" "$__cdist_out_execs"
 cdist-exec-run                "$__cdist_target_host"
diff --git a/bin/cdist-object-explorer-all b/bin/cdist-object-explorer-all
index cd4fee6f..45628f4a 100755
--- a/bin/cdist-object-explorer-all
+++ b/bin/cdist-object-explorer-all
@@ -28,6 +28,23 @@ set -eu
 __cdist_target_host="$1"; shift
 __cdist_object_base_dir="$1"; shift
 
+################################################################################
+# New code
+#
+
+# Get listing of objects
+
+# Get listing of types used
+
+# For every type that has explorers, Transfer the explorers
+
+# For every object of a type that has explorers, execute the explorers
+# and retrieve the results
+
+################################################################################
+# Old code
+#
+
 __cdist_object_list "$__cdist_object_base_dir" > "$__cdist_tmp_file"
 
 # need to create pseudo array, as ssh in cdist-explorer-run will destroy while-read loops

From 2831b35aab96e001dd4ab44e806b5b61e4f1a2a2 Mon Sep 17 00:00:00 2001
From: Nico Schottelius <nico@kr.ethz.ch>
Date: Thu, 24 Feb 2011 12:59:25 +0100
Subject: [PATCH 7/7] add log from today

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
---
 doc/dev/logs/2011-02-24 | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 doc/dev/logs/2011-02-24

diff --git a/doc/dev/logs/2011-02-24 b/doc/dev/logs/2011-02-24
new file mode 100644
index 00000000..7ba6d3de
--- /dev/null
+++ b/doc/dev/logs/2011-02-24
@@ -0,0 +1,14 @@
+- Steven, Nico
+
+- all cdist cores change to the local or remote base dir before excution
+  of non-core (i.e. manifests, gencode, ...) executables
+
+- non-core executables get helper information via environment variables:
+
+   general explorers: __explorers
+   initial manifest: __manifests
+   type manifests:  __object, __object_id
+   type explorers:  __object, __object_id, __type_explorers
+   type codegen:  __object, __object_id
+   type code:  -
+