Example Config:
---
:parser: YAML
:precedence:
- %{environment}/nodes/%{fqdn}
- %{environment}/nodes/cluster_%{cluster}
- %{environment}/nodes/site_%{site}
- %{environment}/nodes/default
:yaml:
   :datadir: /usr/share/puppet/environments

Example call:
$default_packages = extlookup('linux_default_packages')

Given an environment called 'testing', cluster called 'cluster1', site
called 'site1' and a node called localhost.localdomain it will look for
variable 'linux_default_packages' in:

/usr/share/puppet/environments/testing/localhost.localdomain.yaml
/usr/share/puppet/environments/testing/cluster_cluster1.yaml
/usr/share/puppet/environments/testing/site_site1.yaml
/usr/share/puppet/environments/testing/default.yaml

In that order, which means you can set this at the default level, then
override at any lower level you like.  Make sense?

On Wed, Aug 3, 2011 at 4:15 PM, Aaron Grewell <aaron.grew...@gmail.com>wrote:

> Precedence is for having it look in multiple places.  I've got node-level,
> site-level, and default YAML files for example.
>
> On Wed, Aug 3, 2011 at 3:50 PM, Douglas Garstang 
> <doug.garst...@gmail.com>wrote:
>
>> Can't get the extlookup() that supports yaml to work.
>>
>> I did this...
>>
>> On server:
>> mv /usr/lib/ruby/site_ruby/1.8/puppet/parser/functions/extlookup.rb
>> /usr/lib/ruby/site_ruby/1.8/puppet/parser/functions/extlookup.rb.orig
>> Replaced /usr/lib/ruby/site_ruby/1.8/puppet/parser/functions/extlookup.rb
>> with puppet-extlookup/lib/puppet/parser/functions/extlookup.rb
>> mkdir /usr/lib/ruby/site_ruby/1.8/puppet/util/extlookup/
>> Added puppet-extlookup/lib/puppet/util/extlookup.rb to
>> /usr/lib/ruby/site_ruby/1.8/puppet/util
>> Added puppet-extlookup/lib/puppet/util/extlookup/csv_parser.rb to
>> /usr/lib/ruby/site_ruby/1.8/puppet/util/extlookup
>> Added puppet-extlookup/lib/puppet/util/extlookup/yaml_parser.rb to
>> /usr/lib/ruby/site_ruby/1.8/puppet/util/extlookup
>> Added puppet-extlookup/lib/puppet/util/extlookup/puppet_parser.rb to
>> /usr/lib/ruby/site_ruby/1.8/puppet/util/extlookup
>>
>> Created /etc/puppet/extlookup.yaml:
>> ---
>> :parser: YAML
>> :precedence:
>> - environment_%{environment}
>> - common
>> :yaml:
>>   :datadir: /etc/puppet/extdata
>>
>> Created /etc/puppet/extdata/settings.yaml:
>> ---
>> testkey: testval
>>
>> Calling with:
>>         $test_var = extlookup('testkey', '---', 'settings.yaml')
>>         notice("TEST VAR=$test_var")
>>
>> And $test_var is always '---'. Replacing settings.yaml with a bogus file
>> name also returns '---', which tells me that the file isn't being found.
>> What am I missing here? Quite possibly a lot given the really bad docs.
>>
>> What is 'precedence' for? Not documented.
>>
>> Doug.
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Puppet Users" group.
>> To post to this group, send email to puppet-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> puppet-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/puppet-users?hl=en.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to