Project

General

Profile

User story #3389 » copyGitFile_14_15.diff

Nicolas PERRON, 2013-09-06 17:19

View differences:

1.5/copyFileFromSharedFolder.st 2013-09-06 17:12:22.673821939 +0200
&COPYFILE_NAME:{name |"copyfile[&i&][name]" string => "&name&";
}&
&COPYFILE_EXCLUDE_INCLUDE:{exclude_include |"copyfile[&i&][exclude_include]" string => "&exclude_include&";
}&
&COPYFILE_EXCLUDE_INCLUDE_OPTION:{exclude_include_option |"copyfile[&i&][exclude_include_option]" string => "&exclude_include_option&";
}&
&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}" and => { isvariable("copyfile[${index}][exclude_include]"), strcmp("${copyfile[${index}][exclude_include_option]}", "exclude") };
"need_inclusion_${index}" and => { isvariable("copyfile[${index}][exclude_include]"), strcmp("${copyfile[${index}][exclude_include_option]}", "include") };
"apply_regex_${index}" or => { "need_exclusion_${index}", "need_inclusion_${index}"};
&COPYFILE_SUID:{suid |"enable_suid_&i&" expression => strcmp("&suid&", "true");
}&
&COPYFILE_SGID:{sgid |"enable_sgid_&i&" expression => strcmp("&sgid&", "true");
}&
# 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.iteration_2::
# 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)).!apply_regex_${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_include]}"),
perms => mog(
"${copyfile[${index}][perm]}",
"${copyfile[${index}][owner]}",
......
),
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 directory, with inclusion
"${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 => by_name("${copyfile[${index}][exclude_include]}"),
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 with inclusion of '${copyfile[${index}][exclude_include]}'",
classes => kept_if_else("copy_file_${index}_kept", "copy_file_${index}_modified", "copy_file_${index}_failed"),
ifvarclass => "(!exist_${index}|!is_file_${index}).need_inclusion_${index}";
# If it s a file, the depth_search prevents from enforcing the file content
# Besides it is possible to specify suid or sgid only for a file since this
......
"${copyfile[${index}][owner]}",
"${copyfile[${index}][group]}"
),
comment => "Enforce content of file ${copyfile[${index}][destination]} based on the content on the Rudder server with ${copyfile[${index}][compare_method]} method",
comment => "Enforce content of file ${copyfile[${index}][destination]} based on the content on the Rudder server with ${copyfile[${index}][compare_method]} method with exclusion of '${copyfile[${index}][exclude_include]}'",
classes => kept_if_else("copy_file_${index}_kept", "copy_file_${index}_modified", "copy_file_${index}_failed"),
ifvarclass => "exist_${index}.is_file_${index}";
1.5/metadata.xml 2013-09-06 17:12:22.673821939 +0200
<DESCRIPTION>Path of the file to be copied</DESCRIPTION>
<LONGDESCRIPTION>This is the relative path of the file/folder to be copied, on the Rudder policy server</LONGDESCRIPTION>
</INPUT>
<SECTION name="Exclusion/Inclusion" multivalued="false" component="false" displayPriority="low">
<SELECT1>
<NAME>COPYFILE_EXCLUDE_INCLUDE_OPTION</NAME>
<DESCRIPTION>Exclude or include files from the copy</DESCRIPTION>
<LONGDESCRIPTION>Limit list of files to copy (include) or don't copy some files matching a pattern (exclude). Only applies if the path to copy from is a directory.</LONGDESCRIPTION>
<ITEM>
<VALUE>none</VALUE>
<LABEL>No include/exclude rules</LABEL>
</ITEM>
<ITEM>
<VALUE>exclude</VALUE>
<LABEL>Exclude file(s) matching</LABEL>
</ITEM>
<ITEM>
<VALUE>include</VALUE>
<LABEL>Include file(s) matching</LABEL>
</ITEM>
<CONSTRAINT>
<DEFAULT>none</DEFAULT>
</CONSTRAINT>
</SELECT1>
<INPUT>
<NAME>COPYFILE_EXCLUDE_INCLUDE</NAME>
<DESCRIPTION>File name patterns to exclude or include</DESCRIPTION>
<LONGDESCRIPTION>If one or several files should be excluded or included in this copy, please insert their name or a regular expression matching the appropriate file name(s))</LONGDESCRIPTION>
<CONSTRAINT>
<MAYBEEMPTY>true</MAYBEEMPTY>
</CONSTRAINT>
</INPUT>
</SECTION>
<INPUT>
<NAME>COPYFILE_DESTINATION</NAME>
<DESCRIPTION>Destination of the file</DESCRIPTION>
(2-2/2)