From 68b7392021b5e6311b3283ab22cbc46cf761b12e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 3 Dec 2013 15:41:43 +0100 Subject: [PATCH] add support for messaging to __file, document messaging in reference Signed-off-by: Nico Schottelius --- cdist/conf/type/__file/gencode-local | 2 ++ cdist/conf/type/__file/gencode-remote | 8 ++++++-- cdist/conf/type/__file/man.text | 14 ++++++++++---- docs/man/cdist-reference.text.sh | 8 +++++++- 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/cdist/conf/type/__file/gencode-local b/cdist/conf/type/__file/gencode-local index a9eb6b10..601705c8 100755 --- a/cdist/conf/type/__file/gencode-local +++ b/cdist/conf/type/__file/gencode-local @@ -30,6 +30,7 @@ create_file= if [ "$state_should" = "present" -o "$state_should" = "exists" ]; then if [ ! -f "$__object/parameter/source" ]; then create_file=1 + echo create >> "$__messages_out" else source="$(cat "$__object/parameter/source")" if [ "$source" = "-" ]; then @@ -64,6 +65,7 @@ if [ "$state_should" = "present" -o "$state_should" = "exists" ]; then destination_upload="\$($__remote_exec $__target_host "mktemp $tempfile_template")" DONE if [ "$upload_file" ]; then + echo upload >> "$__messages_out" cat << DONE $__remote_copy $source ${__target_host}:\$destination_upload DONE diff --git a/cdist/conf/type/__file/gencode-remote b/cdist/conf/type/__file/gencode-remote index e80d5fae..57bf3503 100755 --- a/cdist/conf/type/__file/gencode-remote +++ b/cdist/conf/type/__file/gencode-remote @@ -43,15 +43,18 @@ get_current_value() { } set_group() { - echo chgrp \"$1\" \"$destination\" + echo chgrp \"$1\" \"$destination\" + echo chgrp $1 >> "$__messages_out" } set_owner() { - echo chown \"$1\" \"$destination\" + echo chown \"$1\" \"$destination\" + echo chown $1 >> "$__messages_out" } set_mode() { echo chmod \"$1\" \"$destination\" + echo chmod $1 >> "$__messages_out" } set_attributes= @@ -73,6 +76,7 @@ case "$state_should" in absent) if [ "$type" = "file" ]; then echo rm -f \"$destination\" + echo remove >> "$__messages_out" fi ;; diff --git a/cdist/conf/type/__file/man.text b/cdist/conf/type/__file/man.text index b76573bb..a582b27b 100644 --- a/cdist/conf/type/__file/man.text +++ b/cdist/conf/type/__file/man.text @@ -52,12 +52,18 @@ source:: MESSAGES -------- - -copy:: - File was copied because cksum was different from local version - +chgrp :: + Changed group membership +chown :: + Changed owner +chmod :: + Changed mode +create:: + Empty file was created (no --source specified) remove:: File exists, but state is absent, file will be removed by generated code. +upload:: + File was uploaded EXAMPLES diff --git a/docs/man/cdist-reference.text.sh b/docs/man/cdist-reference.text.sh index b41be801..a72452eb 100755 --- a/docs/man/cdist-reference.text.sh +++ b/docs/man/cdist-reference.text.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# 2010-2012 Nico Schottelius (nico-cdist at schottelius.org) +# 2010-2013 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -191,6 +191,12 @@ __manifest:: __global:: Directory that contains generic output like explorer. Available for: initial manifest, type manifest, type gencode, shell +__messages_in:: + File to read messages from + Available for: initial manifest, type manifest, type gencode +__messages_out:: + File to write messages + Available for: initial manifest, type manifest, type gencode __object:: Directory that contains the current object. Available for: type manifest, type explorer, type gencode