From 10088e52054663c8ae4b0e92092d6ff017102e16 Mon Sep 17 00:00:00 2001 From: Ben Ford Date: Tue, 15 Mar 2016 09:26:25 -0700 Subject: [PATCH] This function is not needed. The `file()` function accepts a list of paths, and the contents of the first one that exists will be returned. To get the same functionality as the removed function, just pass '/dev/null' as the second path. --- .../puppet/parser/functions/no_fail_file.rb | 36 ------------------- .../manifests/git_webhook/code_manager.pp | 2 +- 2 files changed, 1 insertion(+), 37 deletions(-) delete mode 100644 site/no_fail_file/lib/puppet/parser/functions/no_fail_file.rb diff --git a/site/no_fail_file/lib/puppet/parser/functions/no_fail_file.rb b/site/no_fail_file/lib/puppet/parser/functions/no_fail_file.rb deleted file mode 100644 index 3819ebf..0000000 --- a/site/no_fail_file/lib/puppet/parser/functions/no_fail_file.rb +++ /dev/null @@ -1,36 +0,0 @@ -require 'puppet/file_system' - -Puppet::Parser::Functions::newfunction( - :no_fail_file, :arity => -2, :type => :rvalue, - :doc => "Loads a file from a module and returns its contents as a string. - - This is a replacement to the file function that returns nothing - if the file specified cannot be found instead of erroring out. - - The argument to this function should be a `/` - reference, which will load `` from a module's `files` - directory. (For example, the reference `mysql/mysqltuner.pl` will load the - file `/mysql/files/mysqltuner.pl`.) - - This function can also accept: - - * An absolute path, which can load a file from anywhere on disk. - * Multiple arguments, which will return the contents of the **first** file - found, skipping any files that don't exist. - " -) do |vals| - path = nil - vals.each do |file| - found = Puppet::Parser::Files.find_file(file, compiler.environment) - if found && Puppet::FileSystem.exist?(found) - path = found - break - end - end - - if path - Puppet::FileSystem.read_preserve_line_endings(path) - else - nil - end -end diff --git a/site/profile/manifests/git_webhook/code_manager.pp b/site/profile/manifests/git_webhook/code_manager.pp index 41c9e16..b2590e9 100644 --- a/site/profile/manifests/git_webhook/code_manager.pp +++ b/site/profile/manifests/git_webhook/code_manager.pp @@ -87,7 +87,7 @@ class profile::git_webhook::code_manager { #this file cannont be read until the next run after the above exec #because the file function runs on the master not on the agent #so the file doesn't exist at the time the function is run - $rbac_token_file_contents = no_fail_file($token_filename) + $rbac_token_file_contents = file($token_filename, '/dev/null') #Only mv code if this is at least the 2nd run of puppet #Code manager needs to be enabled and puppet server restarted