From 7c8dba566f5105dd58a4237ccb94cbcdeb646e5c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 2 Feb 2011 19:53:13 +0100 Subject: [PATCH] add source record information to created objects Signed-off-by: Nico Schottelius --- bin/cdist-config | 3 +++ bin/cdist_tree_wrapper | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/bin/cdist-config b/bin/cdist-config index c87dc56e..b0966487 100755 --- a/bin/cdist-config +++ b/bin/cdist-config @@ -60,6 +60,9 @@ __cdist_bin_prefix="__" # Used for IDs __cdist_sane_chars='[A-Za-z0-9_]' +# Used to mark file that created a specific type +__cdist_object_source=".source" + ################################################################################ # Function list # diff --git a/bin/cdist_tree_wrapper b/bin/cdist_tree_wrapper index 254de003..b5d073fc 100755 --- a/bin/cdist_tree_wrapper +++ b/bin/cdist_tree_wrapper @@ -38,9 +38,8 @@ __cdist_tid="${__cdist_myname}/${__cdist_id}" __cdist_ddir="$(__cdist_cache_host)/${__cdist_tid}" if [ -e "${__cdist_ddir}" ]; then - # FIXME: add source! $cdist_config_base/source - # FIXME: force $source information to be present from outside! - __cdist_usage "${__cdist_tid} already exists" + source="$(cat "${__cdist_ddir}/${__cdist_object_source}")" + __cdist_usage "${__cdist_tid} already exists (source: $source)" fi mkdir -p "${__cdist_ddir}" @@ -61,4 +60,6 @@ while [ $# -gt 0 ]; do echo "${value}" > "${__cdist_ddir}/${opt_file}" + echo "${__cdist_abs_myname}" > "${__cdist_ddir}/${__cdist_object_source}" + done