Puppet Function: validate_file_exists
- Defined in:
- lib/puppet/functions/validate_file_exists.rb
- Function type:
- Ruby 4.x API
Overview
Validate that the file exists.
This function can work only when running puppet apply.
TODO:
Find a way how to skip it for puppetmaster scenario.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/puppet/functions/validate_file_exists.rb', line 5 Puppet::Functions.create_function(:validate_file_exists) do # @param files Files to verify # @return true when all files exist, an exception otherwise dispatch :validate_file_exists do required_repeated_param 'Stdlib::Absolutepath', :files return_type 'Boolean' end def validate_file_exists(*files) files.each do |file| raise Puppet::Error, "#{file} does not exist" unless File.exist?(file) end true end end |