You'll need to call Puppet.initialize_settings, that should setup the
environment.

On Wed, Nov 18, 2015 at 4:09 PM, Corey Osman <co...@logicminds.biz> wrote:

> I am testing out some ruby code that tests functions.  However, I can’t
> seem to load the function file or call other function methods to what seems
> to be an environment object error.
>
>
> Any ideas, is there some other file that I need to load or config I need
> to set?
>
>
>
>  require 'puppet'
> => true
> irb(main):008:0> Puppet::Parser::Functions.function(:notice)
> NoMethodError: undefined method `[]' for nil:NilClass
>         from
> /home/puppet/.gem/ruby/gems/puppet-4.2.2/lib/puppet/parser/functions.rb:44:in
> `environment_module'
>         from
> /home/puppet/.gem/ruby/gems/puppet-4.2.2/lib/puppet/parser/functions.rb:257:in
> `get_function'
>         from
> /home/puppet/.gem/ruby/gems/puppet-4.2.2/lib/puppet/parser/functions.rb:190:in
> `function'
>         from (irb):8
>         from /usr/bin/irb:12:in `<main>’
>
>
>
>
> irb(main):003:0> require 'puppet/parser/functions/md5'
> NoMethodError: undefined method `[]' for nil:NilClass
>         from
> /Library/Ruby/Gems/2.0.0/gems/puppet-4.2.2/lib/puppet/parser/functions.rb:44:in
> `environment_module'
>         from
> /Library/Ruby/Gems/2.0.0/gems/puppet-4.2.2/lib/puppet/parser/functions.rb:257:in
> `get_function'
>         from
> /Library/Ruby/Gems/2.0.0/gems/puppet-4.2.2/lib/puppet/parser/functions.rb:137:in
> `newfunction'
>         from
> /Library/Ruby/Gems/2.0.0/gems/puppet-4.2.2/lib/puppet/parser/functions/md5.rb:3:in
> `<top (required)>'
>         from
> /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in
> `require'
>         from
> /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in
> `require'
>         from (irb):3
>         from /usr/bin/irb:12:in `<main>’
>
>
> Corey
>
>
>
>
>
> --
> 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/267D6994-1208-40A7-AE83-331A5040282D%40nwops.io
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Michael Smith
Developer, Puppet Labs

-- 
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/CABy1mMLMB8%2Bor-XBD0BaadCGLgUNQtq7ZdL%3DmJgHgNYikfOZ8w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to