On Thu, Sep 4, 2014 at 1:14 PM, Andy Parker <a...@puppetlabs.com> wrote:

> On Thu, Sep 4, 2014 at 1:05 PM, Joshua Partlow <
> joshua.part...@puppetlabs.com> wrote:
>
>> On Thu, Sep 4, 2014 at 12:34 PM, Nan Liu <nan....@gmail.com> wrote:
>>
>>> Yes, I'm looking for the environment specific modulepath.
>>>
>>> Maybe this is a more complete example:
>>>  example = Puppet::Module.find('example', Puppet[:environment].to_s)
>>> raise(LoadError, "Unable to find example module in modulepath
>>> #{Puppet[:modulepath]}") unless example
>>> YAML.load_file(File.join(example.path, 'data/foo.yaml'))
>>>
>>
>> Where will this code be executing?  On the master, during a catalog
>> compilation?  If so, you probably want:
>>
>
Yep.

 environment = Puppet.lookup(:current_environment)
>> environment.modulepath
>>
>
> and
>
>   mod = environment.module('example')
>
> to get the module from the environment.
>

This is exactly what I was looking for. Thanks!

Nan

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-dev/CACqVBqD8d9iOYyxhb2ZgFeK4ymsQ0mTXS4wbzLVkJhYNJrrYLw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to