[chef] Re: ruby_block documentation wrong; how to set up a RunContext?


Chronological Thread 
  • From: Ranjib Dey < >
  • To:
  • Subject: [chef] Re: ruby_block documentation wrong; how to set up a RunContext?
  • Date: Wed, 25 Sep 2013 11:48:20 -0700

Some more example:
1) set up run context of a node externally (gran ohai 's json to build the node, pass it to the run context), i use this to build chef resource list of a container inside its host, outside itself
2) Also you can directly subclass Chef::Client to reuse all the batteries,
https://github.com/ranjib/chef-stage/blob/master/libraries/staged_chef_client.rb
3) I have not checked, but i think use_inline_resources implementation also has some zen, @kallistec will be able to shed some light on that


On Wed, Sep 25, 2013 at 11:41 AM, Ranjib Dey < " target="_blank"> > wrote:
a run context object expects a node object at leas (rc= Chef::RunContext.new(node, nil, nil)) , check the setup_run_context method inside lib/chef/client.rb


On Wed, Sep 25, 2013 at 11:23 AM, Brian Hatfield < " target="_blank"> > wrote:
I have a library that needs to set up a raw ruby resource, similar to how it's documented here: http://docs.opscode.com/chef/resources.html#ruby-block. Unfortunately, part of that is setting up the RunContext, which I cannot find properly documented anywhere.

The code snippet `run_context = Chef::RunContext.new(node, {})` fails with an ArgumentError `wrong number of arguments (2 for 3)`, which after looking at the raw RunContext code, is correct - it wants a third, undocumented argument called "events".

How do I instantiate such an object to pass to the RunContext so I can get my resource to work correctly? Can someone point me at some documentation or an example for this?

Thank you!
Brian





Archive powered by MHonArc 2.6.16.

§