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 [ ! -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
   ;;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -52,12 +52,18 @@ source::
 | 
			
		|||
 | 
			
		||||
MESSAGES
 | 
			
		||||
--------
 | 
			
		||||
 | 
			
		||||
copy::
 | 
			
		||||
    File was copied because cksum was different from local version
 | 
			
		||||
 | 
			
		||||
chgrp <group>::
 | 
			
		||||
    Changed group membership
 | 
			
		||||
chown <owner>::
 | 
			
		||||
    Changed owner
 | 
			
		||||
chmod <mode>::
 | 
			
		||||
    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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue