add support for messaging to __file, document messaging in reference
Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
This commit is contained in:
		
					parent
					
						
							
								684ad56a80
							
						
					
				
			
			
				commit
				
					
						68b7392021
					
				
			
		
					 4 changed files with 25 additions and 7 deletions
				
			
		| 
						 | 
					@ -30,6 +30,7 @@ create_file=
 | 
				
			||||||
if [ "$state_should" = "present" -o "$state_should" = "exists" ]; then
 | 
					if [ "$state_should" = "present" -o "$state_should" = "exists" ]; then
 | 
				
			||||||
   if [ ! -f "$__object/parameter/source" ]; then
 | 
					   if [ ! -f "$__object/parameter/source" ]; then
 | 
				
			||||||
      create_file=1
 | 
					      create_file=1
 | 
				
			||||||
 | 
					      echo create >> "$__messages_out"
 | 
				
			||||||
   else
 | 
					   else
 | 
				
			||||||
      source="$(cat "$__object/parameter/source")"
 | 
					      source="$(cat "$__object/parameter/source")"
 | 
				
			||||||
      if [ "$source" = "-" ]; then
 | 
					      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")"
 | 
					destination_upload="\$($__remote_exec $__target_host "mktemp $tempfile_template")"
 | 
				
			||||||
DONE
 | 
					DONE
 | 
				
			||||||
      if [ "$upload_file" ]; then
 | 
					      if [ "$upload_file" ]; then
 | 
				
			||||||
 | 
					         echo upload >> "$__messages_out"
 | 
				
			||||||
         cat << DONE
 | 
					         cat << DONE
 | 
				
			||||||
$__remote_copy $source ${__target_host}:\$destination_upload
 | 
					$__remote_copy $source ${__target_host}:\$destination_upload
 | 
				
			||||||
DONE
 | 
					DONE
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -43,15 +43,18 @@ get_current_value() {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set_group() {
 | 
					set_group() {
 | 
				
			||||||
   echo chgrp \"$1\" \"$destination\"
 | 
					    echo chgrp \"$1\" \"$destination\"
 | 
				
			||||||
 | 
					    echo chgrp $1 >> "$__messages_out"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set_owner() {
 | 
					set_owner() {
 | 
				
			||||||
   echo chown \"$1\" \"$destination\"
 | 
					    echo chown \"$1\" \"$destination\"
 | 
				
			||||||
 | 
					    echo chown $1 >> "$__messages_out"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set_mode() {
 | 
					set_mode() {
 | 
				
			||||||
   echo chmod \"$1\" \"$destination\"
 | 
					   echo chmod \"$1\" \"$destination\"
 | 
				
			||||||
 | 
					   echo chmod $1 >> "$__messages_out"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set_attributes=
 | 
					set_attributes=
 | 
				
			||||||
| 
						 | 
					@ -73,6 +76,7 @@ case "$state_should" in
 | 
				
			||||||
   absent)
 | 
					   absent)
 | 
				
			||||||
      if [ "$type" = "file" ]; then
 | 
					      if [ "$type" = "file" ]; then
 | 
				
			||||||
         echo rm -f \"$destination\"
 | 
					         echo rm -f \"$destination\"
 | 
				
			||||||
 | 
					         echo remove >> "$__messages_out"
 | 
				
			||||||
      fi
 | 
					      fi
 | 
				
			||||||
   ;;
 | 
					   ;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -52,12 +52,18 @@ source::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
MESSAGES
 | 
					MESSAGES
 | 
				
			||||||
--------
 | 
					--------
 | 
				
			||||||
 | 
					chgrp <group>::
 | 
				
			||||||
copy::
 | 
					    Changed group membership
 | 
				
			||||||
    File was copied because cksum was different from local version
 | 
					chown <owner>::
 | 
				
			||||||
 | 
					    Changed owner
 | 
				
			||||||
 | 
					chmod <mode>::
 | 
				
			||||||
 | 
					    Changed mode
 | 
				
			||||||
 | 
					create::
 | 
				
			||||||
 | 
					    Empty file was created (no --source specified)
 | 
				
			||||||
remove::
 | 
					remove::
 | 
				
			||||||
    File exists, but state is absent, file will be removed by generated code.
 | 
					    File exists, but state is absent, file will be removed by generated code.
 | 
				
			||||||
 | 
					upload::
 | 
				
			||||||
 | 
					    File was uploaded
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EXAMPLES
 | 
					EXAMPLES
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
#!/bin/sh
 | 
					#!/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.
 | 
					# This file is part of cdist.
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
| 
						 | 
					@ -191,6 +191,12 @@ __manifest::
 | 
				
			||||||
__global::
 | 
					__global::
 | 
				
			||||||
    Directory that contains generic output like explorer.
 | 
					    Directory that contains generic output like explorer.
 | 
				
			||||||
    Available for: initial manifest, type manifest, type gencode, shell
 | 
					    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::
 | 
					__object::
 | 
				
			||||||
    Directory that contains the current object.
 | 
					    Directory that contains the current object.
 | 
				
			||||||
    Available for: type manifest, type explorer, type gencode
 | 
					    Available for: type manifest, type explorer, type gencode
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue