diff --git a/bin/cdist-config b/bin/cdist-config index 3e474331..c1179b0d 100755 --- a/bin/cdist-config +++ b/bin/cdist-config @@ -35,15 +35,16 @@ set -u : ${__cdist_name_gencode:=gencode} : ${__cdist_name_host:=hosts} : ${__cdist_name_init:=init} +: ${__cdist_name_manifest:=manifest} +: ${__cdist_name_manifest_dir:=manifests} : ${__cdist_name_out_dir:=out} : ${__cdist_name_conf_dir:=conf} : ${__cdist_name_type_bin:=type_bin} -# Exported variable names +# Exported variable names (usable for non core) : ${__cdist_name_var_explorer:=__$__cdist_name_explorer} +: ${__cdist_name_var_manifest:=__$__cdist_name_manifest_dir} -# Name of the manifest file in types -: ${__cdist_name_manifest:=manifest} # Name of the base directory containing the initial manifests : ${__cdist_name_manifests:=manifests} diff --git a/bin/cdist-deploy-to b/bin/cdist-deploy-to index 88b7aaf9..9c042c41 100755 --- a/bin/cdist-deploy-to +++ b/bin/cdist-deploy-to @@ -44,7 +44,7 @@ cdist-bin-transfer "$__cdist_target_host" "$__cdist_remote_bin_dir" 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" +cdist-manifest-run-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" diff --git a/bin/cdist-manifest-run b/bin/cdist-manifest-run index 5ed2c4fe..367ac96f 100755 --- a/bin/cdist-manifest-run +++ b/bin/cdist-manifest-run @@ -23,14 +23,16 @@ # . cdist-config -[ $# -ge 4 ] || __cdist_usage " [manifest arguments]" +[ $# -ge 3 ] || __cdist_usage " [manifest arguments]" set -u __cdist_target_host="$1"; shift -__cdist_work_dir="$1"; shift __cdist_manifest="$1"; shift __cdist_output_dir="$1"; shift +# Always start from local base +__cdist_work_dir="$__cdist_local_base_dir" + # Ensure binaries exist and are up-to-date cdist-type-build-emulation || __cdist_exit_err "Failed to build type emulation binaries" diff --git a/bin/cdist-manifest-run-all b/bin/cdist-manifest-run-all index 5d21b70c..5e58a205 100755 --- a/bin/cdist-manifest-run-all +++ b/bin/cdist-manifest-run-all @@ -61,6 +61,9 @@ 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}" + # Make __cdist_manifest available for cdist-type-emulator + export __cdist_manifest + if [ -x "${__cdist_manifest}" ]; then echo "Executing manifest ${__cdist_manifest} ..." diff --git a/bin/cdist-manifest-run-init b/bin/cdist-manifest-run-init index 9e8a346f..79329252 100755 --- a/bin/cdist-manifest-run-init +++ b/bin/cdist-manifest-run-init @@ -26,8 +26,9 @@ [ $# -eq 2 ] || __cdist_usage " " set -e -export __cdist_target_host="$1"; shift -export __cdist_output_dir="$1"; shift +__cdist_target_host="$1"; shift +__cdist_output_dir="$1"; shift -cdist-manifest-run "$__cdist_target_host" "$__cdist_local_base_dir" \ - "$__cdist_manifest_init" "$__cdist_output_dir" +eval export $__cdist_name_var_manifest=\"\$__cdist_manifest_dir\" + +cdist-manifest-run "$__cdist_target_host" "$__cdist_manifest_init" "$__cdist_output_dir" diff --git a/conf/manifests/init b/conf/manifests/init index 20714bad..736985fe 100755 --- a/conf/manifests/init +++ b/conf/manifests/init @@ -2,6 +2,8 @@ # This is a sample manifest, but used in real world # +echo $__manifests + # All systems get a file /etc/cdist-managed, so the sysadmin knows # who manages the configuration. #__file /etc/cdist-managed --type file diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index 6b263955..21b3883a 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -1,3 +1,5 @@ add explorers per type/object - change exec directory for all stages - create cdist-remote-explorer-run that sets + - iterate over all stages again + - ensure discussed variables are in place