On 2014-01-05 11:18, KomodoDave wrote:
Thanks for the response, Henrik.
I’ve tried what you suggested already:
|node=Puppet::Node.new('localhost')
compiler=Puppet::Parser::Compiler.new(node)
scope=Puppet::Parser::Scope.new(compiler)
|
..but the result is:
|
/usr/lib/ruby/vendor_ruby/puppet/context.rb:43:in `lookup': no 'environments' in
{:root_environment=>#<Puppet::Node::Environment:0x7f31f0383230 @modulepath=[], @name=:"*root*",
@manifest="path_to_my_script_dir">, :current_environment=>#<Puppet::Node::Environment:0x7f31f0383230 @modulepath=[],
@name=:"*root*", @manifest="path_to_my_script_dir">} at top of [] (Puppet::Context::UndefinedBindingError)
|
..where |path_to_my_script_dir| is the absolute path of the directory
containing my ruby script.
Is there a way for me to set up the correct context and/or environments
mentioned in this error message?
Sorry, your function is obviously not inside puppet itself and needs to
be setup. Look at how tests are done for functions in puppet-stdlib, it
uses rspec-puppet to help with setting up things for the tests.
https://github.com/puppetlabs/puppetlabs-stdlib/tree/master/spec/functions
Hope that helps.
- henrik
--
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 puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/5363A91A.4000405%40cloudsmith.com.
For more options, visit https://groups.google.com/d/optout.