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.
>
>
>
Actually, when I run the puppetmaster in debug mode on the server, I see:

debug: Automatically imported testmodule::test01 from testmodule/test01 into
prod2
debug: extlookup/yaml: looking for key=testkey with default=---
debug: extlookup/yaml: Looking for data in /etc/puppet/extdata
debug: extlookup/yaml: Looking for data in
/etc/puppet/extdata/settings.yaml.yaml
debug: extlookup/yaml: Looking for data in
/etc/puppet/extdata/environment_prod2.yaml
debug: extlookup/yaml: Looking for data in /etc/puppet/extdata/common.yaml
notice: Scope(Class[Testmodule::Test01]): TEST VAR=---
debug: File[/tmp/y]: Adding default for backup

.... so, it's looking in the right place for the right key.... it just
doesn't get it...

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.

Reply via email to