[chef] Re: Re: how to interchange data between different recipes on open source chef


Chronological Thread 
  • From: John Dewey < >
  • To:
  • Subject: [chef] Re: Re: how to interchange data between different recipes on open source chef
  • Date: Mon, 9 Sep 2013 21:25:09 -0700

++

I use this method in the reboot-handler cookbook (https://github.com/retr0h/cookbook-reboot-handler/blob/master/files/default/reboot.rb)

John

On Monday, September 9, 2013 at 8:37 PM, David Petzel wrote:

I have not done it myself, but I did think editing databags from a recipe was possible, and is documented here: http://docs.opscode.com/essentials_data_bags.html#create-and-edit

If you don't need the data to persist across chef runs (IE you just need to exchange it during the course of a single run) I have used the `node.run_state` variable.
so something like:
recipe1.rb:
  node.run_state[:my_data] = "Hello"
recipe2.rb:
  puts node.run_state[:my_data]


I have two recipes my open source chef server and need to interchange some data between them. I wondering how to do that. If someone give a hint, it will much appreciated.

PS: I tried to write the data into a databag, but failed as below. It looks like recipes save data into a databag is allowed.

Net::HTTPServerException
------------------------
405 "Method Not Allowed"







Archive powered by MHonArc 2.6.16.

§