diff --git a/conf/type/__directory/gencode-remote b/conf/type/__directory/gencode-remote index 7fd589be..e9feecf4 100755 --- a/conf/type/__directory/gencode-remote +++ b/conf/type/__directory/gencode-remote @@ -17,12 +17,6 @@ # You should have received a copy of the GNU General Public License # along with cdist. If not, see . # -# -# Handle directories -# -# -# __directory /etc [--mode --owner --group --parents [yes|no] ] -# destination="/$__object_id" state_should="$(cat "$__object/parameter/state")" diff --git a/conf/type/__directory/manifest b/conf/type/__directory/manifest index 2fcc085d..a8ee5a6f 100755 --- a/conf/type/__directory/manifest +++ b/conf/type/__directory/manifest @@ -18,8 +18,6 @@ # along with cdist. If not, see . # -if [ -f "$__object/parameter/state" ]; then - state="$(cat "$__object/parameter/state")" -else - echo "present" > "$__object/parameter/state" -fi +# set defaults +state="$(cat "$__object/parameter/state" 2>/dev/null \ + || echo "present" | tee "$__object/parameter/state")" diff --git a/conf/type/__file/gencode-local b/conf/type/__file/gencode-local index ee198fb1..d9839a19 100755 --- a/conf/type/__file/gencode-local +++ b/conf/type/__file/gencode-local @@ -33,11 +33,7 @@ if [ "$state_should" = "present" ]; then remote_cksum="$(cat "$__object/explorer/cksum")" if [ "$local_cksum" != "$remote_cksum" ]; then - # FIXME: The username is ugly and hardcoded, replace after 1.0! - # Probably a better aproach is to have the user configured - # ~/.ssh/config to contain the right username - # Probably describe it in cdist-quickstart... - echo scp "$source" "root@${__target_host}:${destination}" + echo "$__remote_copy" "$source" "${__target_host}:${destination}" fi else echo "Source \"$source\" does not exist." >&2 diff --git a/conf/type/__file/manifest b/conf/type/__file/manifest index 59f10e42..915a2ca9 100755 --- a/conf/type/__file/manifest +++ b/conf/type/__file/manifest @@ -20,8 +20,6 @@ name="$__object_id" -if [ -f "$__object/parameter/state" ]; then - state="$(cat "$__object/parameter/state")" -else - echo "present" > "$__object/parameter/state" -fi +# set defaults +state="$(cat "$__object/parameter/state" 2>/dev/null \ + || echo "present" | tee "$__object/parameter/state")" diff --git a/conf/type/__link/manifest b/conf/type/__link/manifest index 2fcc085d..a8ee5a6f 100755 --- a/conf/type/__link/manifest +++ b/conf/type/__link/manifest @@ -18,8 +18,6 @@ # along with cdist. If not, see . # -if [ -f "$__object/parameter/state" ]; then - state="$(cat "$__object/parameter/state")" -else - echo "present" > "$__object/parameter/state" -fi +# set defaults +state="$(cat "$__object/parameter/state" 2>/dev/null \ + || echo "present" | tee "$__object/parameter/state")"