Project

General

Profile

User story #3389 » download_from_a_shared_folder_diff_1-3_1-4.diff

Nicolas PERRON, 2013-04-03 21:03

View differences:

1.4/copyFileFromSharedFolder.st 2013-04-03 20:51:46.242725680 +0200
&COPYFILE_NAME:{name |"copyfile[&i&][name]" string => "&name&";
}&
&COPYFILE_EXCLUDE:{exclude |"copyfile[&i&][exclude" string => "&exclude&";
}&
&COPYFILE_RECURSION:{rec |"copyfile[&i&][recursion]" string => "&rec&";
}&
......
"is_file_$(index)" not => isdir("$(copyfile[$(index)][destination])");
"exist_$(index)" expression => fileexists("$(copyfile[$(index)][destination])");
"need_exclusion_${index}" expression => isvariable("${copyfile[${index}][exclude]}");
# Set a class to define when we need to run the post-modification hook
&COPYFILE_POST_HOOK_RUN:{run |"execute_command_&i&" expression => strcmp("&run&", "true");
......
files:
is_valid::
# If it's a directory, without exclusion
"$(copyfile[$(index)][destination])"
copy_from => scp("&SHARED_FILES_FOLDER&/$(copyfile[$(index)][name])", "$(server_info.cfserved)", "$(copyfile[$(index)][compare_method])", "false", "false", "false"),
depth_search => recurse("$(copyfile[$(index)][recursion])"),
perms => mog("$(copyfile[$(index)][perm])"
, "$(copyfile[$(index)][owner])"
, "$(copyfile[$(index)][group])"),
comment => "Enforce content of $(copyfile[$(index)][destination]) based on the content on the Rudder server with $(copyfile[$(index)][compare_method]) method",
classes => kept_if_else("copy_file_$(index)_kept", "copy_file_$(index)_modified", "copy_file_$(index)_failed"),
ifvarclass => "(!exist_$(index)|!is_file_$(index)).!need_exclusion_${index}";
# If it's a directory, with exclusion
"$(copyfile[$(index)][destination])"
copy_from => scp("&SHARED_FILES_FOLDER&/$(copyfile[$(index)][name])", "$(server_info.cfserved)", "$(copyfile[$(index)][compare_method])", "false", "false", "false"),
depth_search => recurse("$(copyfile[$(index)][recursion])"),
file_select => exclude("${copyfile[${index}][exclude]}"),
perms => mog("$(copyfile[$(index)][perm])"
, "$(copyfile[$(index)][owner])"
, "$(copyfile[$(index)][group])"),
comment => "Enforce content of $(copyfile[$(index)][destination]) based on the content on the Rudder server with $(copyfile[$(index)][compare_method]) method",
classes => kept_if_else("copy_file_$(index)_kept", "copy_file_$(index)_modified", "copy_file_$(index)_failed"),
ifvarclass => "!exist_$(index)|!is_file_$(index)";
ifvarclass => "(!exist_$(index)|!is_file_$(index)).need_exclusion_${index}";
# If it's a file, the depth_search prevents from enforcing the file content
"$(copyfile[$(index)][destination])"
1.4/policy.xml 2013-04-03 20:53:35.890723285 +0200
<LONGDESCRIPTION>This is the relative path of the file/folder to be copied, on the Rudder policy server</LONGDESCRIPTION>
</INPUT>
<INPUT>
<NAME>COPYFILE_EXCLUDE</NAME>
<DESCRIPTION>File(s) to exclude</DESCRIPTION>
<LONGDESCRIPTION>If one or several files should be exclude from copy, please insert its name or a regular expression matching the appropriate file(s)</LONGDESCRIPTION>
</INPUT>
<INPUT>
<NAME>COPYFILE_DESTINATION</NAME>
<DESCRIPTION>Destination of the file</DESCRIPTION>
<LONGDESCRIPTION>This is the absolute path of the file/folder on the managed node</LONGDESCRIPTION>
(1-1/2)