On Thu, Sep 4, 2014 at 12:34 PM, Nan Liu <[email protected]> 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:

environment = Puppet.lookup(:current_environment)
environment.modulepath


> So for the directory below:
> /etc/puppet/environment/production/modules/example/data/foo.yaml
> /etc/puppet/environment/test/modules/example/data/foo.yaml
> /etc/puppet/environment/qa/modules/
>
> When an agent connections to environment qa, the error message should be:
> Unable to find example module in modulepath
> /etc/puppet/environment/qa/modules/
>
> I haven't had a chance to spin up a test master to see if
> Puppet[:basemodulepath] works yet, but it seems to work in irb.
>
> Thanks,
>
> Nan
>
> On Thu, Sep 4, 2014 at 11:27 AM, Joshua Partlow <
> [email protected]> wrote:
>
>> Hi Nan,
>>
>> The modulepath is really only meaningful from an actual environment
>> instance.  What code are you writing?  You'll probably want to lookup the
>> current environment or make use of the environment instance available in
>> your local context (if there is one).
>>
>>
>> On Thu, Sep 4, 2014 at 10:08 AM, Trevor Vaughan <[email protected]>
>> wrote:
>>
>>> I think it's Puppet[:basemodulepath] but this needs to be combined with
>>> your environment path search.
>>>
>>> Trevor
>>>
>>>
>>> On Thu, Sep 4, 2014 at 1:03 PM, Nan Liu <[email protected]> wrote:
>>>
>>>> I have some code that's doing module searching in the module path:
>>>>
>>>> example = Puppet::Module.find('example', Puppet[:environment].to_s)
>>>> raise(LoadError, "Unable to find example module in modulepath
>>>> #{Puppet[:modulepath]}") unless example
>>>>
>>>> In Puppet 3.6, the second line is triggering a the following warning:
>>>> Warning: Accessing 'modulepath' as a setting is deprecated. See
>>>> http://links.puppetlabs.com/env-settings-deprecations
>>>>
>>>> I was able to trace the changes to PUP-2650, but it's not really clear
>>>> where the setting is stored now. What's the correct way to access the
>>>> modulepath configuration in 3.6?
>>>>
>>>> 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 [email protected].
>>>> To view this discussion on the web visit https://groups.google.com/d/
>>>> msgid/puppet-dev/54089B49.40304%40gmail.com.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>>>
>>> --
>>> Trevor Vaughan
>>> Vice President, Onyx Point, Inc
>>> (410) 541-6699
>>> [email protected]
>>>
>>> -- This account not approved for unencrypted proprietary information --
>>>
>>> --
>>> 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 [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/puppet-dev/CANs%2BFoWMs_%2B3_N3HECGeUsBxOO62VdrLrA6aAjd97fjn_Vx4yQ%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/puppet-dev/CANs%2BFoWMs_%2B3_N3HECGeUsBxOO62VdrLrA6aAjd97fjn_Vx4yQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Josh Partlow
>> [email protected]
>> Developer, Puppet Labs
>>
>> Join us at PuppetConf 2014, September 20-24 in San Francisco
>> Register by September 8th to take advantage of the Final Countdown —save
>> $149!
>>
>> --
>> 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 [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/puppet-dev/CADxAQ5r7%3DdkD-Nb5HpEei15%3DG7H5xbxQwaDB3cGepBMwphm6UA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/puppet-dev/CADxAQ5r7%3DdkD-Nb5HpEei15%3DG7H5xbxQwaDB3cGepBMwphm6UA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-dev/CACqVBqD5ES70JRujWqQM2SMsoWmam5X5_9Npgz8e%3DBbjWFZrhw%40mail.gmail.com
> <https://groups.google.com/d/msgid/puppet-dev/CACqVBqD5ES70JRujWqQM2SMsoWmam5X5_9Npgz8e%3DBbjWFZrhw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Josh Partlow
[email protected]
Developer, Puppet Labs

Join us at PuppetConf 2014, September 20-24 in San Francisco
Register by September 8th to take advantage of the Final Countdown —save
$149!

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-dev/CADxAQ5p7SuDZ2W3%3Daw4mWyMRyoE49aTesGN5BzDdty6azD5N4w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to