From fa0a3af2a0d2e5fd0e14c753ca76a4fbef084b28 Mon Sep 17 00:00:00 2001
From: Nico Schottelius <nico@kr.ethz.ch>
Date: Wed, 23 Mar 2011 11:44:33 +0100
Subject: [PATCH] correctly record parameter, remove sed (not required)

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
---
 bin/cdist-type-emulator | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/bin/cdist-type-emulator b/bin/cdist-type-emulator
index 06369895..18171233 100755
--- a/bin/cdist-type-emulator
+++ b/bin/cdist-type-emulator
@@ -73,15 +73,15 @@ __cdist_out_object_dir="$__cdist_tmp_dir"
 
 __cdist_object_dir="$(__cdist_object_dir "$__cdist_object_self")"
 
-set -x
-
 # Record source
 mkdir -p "${__cdist_object_dir}"
 __cdist_object_source_add "${__cdist_object_dir}"
 
 
 # Record parameter
-__cdist_parameter_dir="$(__cdist_object_parameter_dir "$__cdist_object")"
+set -x
+
+__cdist_parameter_dir="$(__cdist_object_parameter_dir "$__cdist_object_self")"
 mkdir -p "${__cdist_parameter_dir}"
 
 while [ $# -gt 0 ]; do
@@ -90,15 +90,17 @@ while [ $# -gt 0 ]; do
    echo "$opt" | grep -q "^--${__cdist_sane_regexp}\$" || \
       __cdist_usage "Provide sane options"
 
-   opt_file="$(echo $opt | sed 's/^--//')"
+   opt_file="${opt#--}"
 
    [ $# -ge 1 ] || __cdist_usage "Missing value for $opt"
 
    value="$1"; shift
 
-   echo "${value}" > "${tempparameter}/${opt_file}"
+   echo "${value}" > "${__cdist_parameter_dir}/${opt_file}"
 done
 
+find $__cdist_object_dir
+
 exit 1