Hi,

In a personal module of my puppetmaster (in the production environment),
I have a custom function which I would like to run on irb (to make
quick test, it would be so convenient). Is it possible?

Here is my environment:
- OS     => Debian Wheezy
- Puppet => 3.7.3
- Ruby   => 1.9.3p194

I have read to do this we can do:

~$ irb
irb> require 'puppet'
irb> require 
'/puppet/production/modules/homemade_functions/lib/puppet/parser/functions/validate_non_empty_data.rb'
irb> Puppet::Parser::Functions.function(:validate_non_empty_data)

But I doesn't work for me:

----------------------------
# irb
irb(main):001:0> require 'puppet'
=> true
irb(main):002:0> require 
'/puppet/production/modules/homemade_functions/lib/puppet/parser/functions/validate_non_empty_data.rb'
NoMethodError: undefined method `[]' for nil:NilClass
        from /usr/lib/ruby/vendor_ruby/puppet/parser/functions.rb:46:in 
`environment_module'
        from /usr/lib/ruby/vendor_ruby/puppet/parser/functions.rb:259:in 
`get_function'
        from /usr/lib/ruby/vendor_ruby/puppet/parser/functions.rb:139:in 
`newfunction'
        from 
/puppet/production/modules/homemade_functions/lib/puppet/parser/functions/validate_non_empty_data.rb:2:in
 `<module:Functions>'
        from 
/puppet/production/modules/homemade_functions/lib/puppet/parser/functions/validate_non_empty_data.rb:1:in
 `<top (required)>'
        from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from (irb):2
        from /usr/bin/irb:12:in `<main>'
----------------------------

I probably miss instructions to recreate the proper execution environment
but which ones?

Thanks in advance for your help.

--
François Lafont

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" 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-users/5494F0E2.9020809%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to