]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/stdlib/lib/puppet/parser/functions/get_module_path.rb
upgrade to stdlib 4.6.1
[dsa-puppet.git] / 3rdparty / modules / stdlib / lib / puppet / parser / functions / get_module_path.rb
1 module Puppet::Parser::Functions
2   newfunction(:get_module_path, :type =>:rvalue, :doc => <<-EOT
3     Returns the absolute path of the specified module for the current
4     environment.
5
6     Example:
7       $module_path = get_module_path('stdlib')
8   EOT
9   ) do |args|
10     raise(Puppet::ParseError, "get_module_path(): Wrong number of arguments, expects one") unless args.size == 1
11     if module_path = Puppet::Module.find(args[0], compiler.environment.to_s)
12       module_path.path
13     else
14       raise(Puppet::ParseError, "Could not find module #{args[0]} in environment #{compiler.environment}")
15     end
16   end
17 end