Puppet Function: simplib::module_exist
- Defined in:
- lib/puppet/functions/simplib/module_exist.rb
- Function type:
- Ruby 4.x API
Overview
Determines if a module exists in the current environment
If passed with an author, such as ‘simp/simplib` or `simp-simplib`, will return whether or not that specific module exists.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/puppet/functions/simplib/module_exist.rb', line 5 Puppet::Functions.create_function(:'simplib::module_exist') do # @param module_name The module name to check # @return [Boolean] Whether or not the module exists in the current environment dispatch :module_exist do required_param 'String[1]', :module_name end def module_exist(module_name) , _module_name = module_name.split(%r(/|-)) unless _module_name _module_name = .dup = nil end if Puppet::Module.find(_module_name, closure_scope.compiler.environment.to_s) if if .strip == call_function('load_module_metadata', _module_name)['name'].strip.split(%r(/|-)).first return true else return false end else return true end else return false end end end |