From 0e8302c20403da8a487b0ba5363741a14f01c079 Mon Sep 17 00:00:00 2001 From: Ander Punnar Date: Tue, 4 Jul 2017 19:23:51 +0300 Subject: [PATCH 1/2] if no --source, then create only if there's no file --- cdist/conf/type/__file/gencode-local | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cdist/conf/type/__file/gencode-local b/cdist/conf/type/__file/gencode-local index c79fc16a..932251fe 100755 --- a/cdist/conf/type/__file/gencode-local +++ b/cdist/conf/type/__file/gencode-local @@ -29,8 +29,11 @@ upload_file= create_file= if [ "$state_should" = "present" -o "$state_should" = "exists" ]; then if [ ! -f "$__object/parameter/source" ]; then - create_file=1 - echo create >> "$__messages_out" + remote_stat="$(cat "$__object/explorer/stat")" + if [ -z "$remote_stat" ]; then + create_file=1 + echo create >> "$__messages_out" + fi else source="$(cat "$__object/parameter/source")" if [ "$source" = "-" ]; then From 6a6716035bfd52043ac34621ab49b3019fb30fe8 Mon Sep 17 00:00:00 2001 From: Ander Punnar Date: Tue, 4 Jul 2017 19:25:08 +0300 Subject: [PATCH 2/2] one space too much --- cdist/conf/type/__file/gencode-local | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cdist/conf/type/__file/gencode-local b/cdist/conf/type/__file/gencode-local index 932251fe..aec4e43e 100755 --- a/cdist/conf/type/__file/gencode-local +++ b/cdist/conf/type/__file/gencode-local @@ -31,8 +31,8 @@ if [ "$state_should" = "present" -o "$state_should" = "exists" ]; then if [ ! -f "$__object/parameter/source" ]; then remote_stat="$(cat "$__object/explorer/stat")" if [ -z "$remote_stat" ]; then - create_file=1 - echo create >> "$__messages_out" + create_file=1 + echo create >> "$__messages_out" fi else source="$(cat "$__object/parameter/source")"