Skip to content

Commit

Permalink
Merge branch 'ust_11174/add_new_method_to_get_file_from_rudder_shared…
Browse files Browse the repository at this point in the history
…_folder_pr'
  • Loading branch information
Normation GIT merger committed Aug 9, 2017
2 parents a6ea4b9 + 630395e commit c254956
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions tree/30_generic_methods/file_from_shared_folder.cf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#####################################################################################
# Copyright 2013 Normation SAS
#####################################################################################
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#####################################################################################

# @name File copy from Rudder shared folder
# @description Ensure that a file or directory is copied from Rudder shared folder (/var/rudder/configuration-repository/shared-files)
#
# @parameter source Source file (path relative to Rudder shared folder)
# @parameter destination Destination file (absolute path on the target node)
# @parameter hash_type Hash algorithm used to check if file is updated
#
# @class_prefix file_from_shared_folder
# @class_parameter destination

bundle agent file_from_shared_folder(source, destination, hash_type)
{
vars:
"promisers" slist => { @{this.callers_promisers}, cf_null }, policy => "ifdefined";
"class_prefix" string => canonify(join("_", "promisers"));
"args" slist => { "${source}", "${destination}" };

methods:
"copy without recursion" usebundle => file_copy_from_remote_source_recursion("/var/rudder/configuration-repository/shared-files/${source}", "${destination}", "0");
"new result classes" usebundle => _classes_copy("${class_prefix}_copy_without_recursion", "${class_prefix}");

"report" usebundle => _log("Copying ${destination} from ${source}", "", "${class_prefix}", @{args});
}

0 comments on commit c254956

Please sign in to comment.