I need the output of a script to set a node value, from inside a cookbook. How would one do this?
Thanks.
-Matt
I need the output of a script to set a node value, from inside a cookbook. How would one do this?
Thanks.
-Matt
On Jun 27, 2011, at 1:46 PM, Matthew Drobnak wrote:
I need the output of a script to set a node value, from inside a cookbook. How would one do this?
You will have to call Chef::ShellOut (or something similar) from within a ruby_block resource.
--Noah
Something like the following should work as well.
node[:myattribute] = %x[/usr/bin/myscript]
John
On Mon, Jun 27, 2011 at 3:55 PM, Noah Kantrowitz noah@coderanger.netwrote:
On Jun 27, 2011, at 1:46 PM, Matthew Drobnak wrote:
I need the output of a script to set a node value, from inside a
cookbook. How would one do this?You will have to call Chef::ShellOut (or something similar) from within a
ruby_block resource.--Noah
--
John Alberts
Would that persist in the chef db? Or would I have to set it each time?
Thanks for the help.
-Matt
On Jun 27, 2011, at 6:25 PM, John Alberts wrote:
Something like the following should work as well.
node[:myattribute] = %x[/usr/bin/myscript]
John
On Mon, Jun 27, 2011 at 3:55 PM, Noah Kantrowitz <noah@coderanger.netmailto:noah@coderanger.net> wrote:
On Jun 27, 2011, at 1:46 PM, Matthew Drobnak wrote:
I need the output of a script to set a node value, from inside a cookbook. How would one do this?
You will have to call Chef::ShellOut (or something similar) from within a ruby_block resource.
--Noah
--
John Alberts
I think I've found it in the wiki:
node.set['myattribute'] = %x[/usr/bin/myscript]
-Matt
On Jun 27, 2011, at 6:30 PM, Matthew Drobnak wrote:
Would that persist in the chef db? Or would I have to set it each time?
Thanks for the help.
-Matt
On Jun 27, 2011, at 6:25 PM, John Alberts wrote:
Something like the following should work as well.
node[:myattribute] = %x[/usr/bin/myscript]
John
On Mon, Jun 27, 2011 at 3:55 PM, Noah Kantrowitz <noah@coderanger.netmailto:noah@coderanger.net> wrote:
On Jun 27, 2011, at 1:46 PM, Matthew Drobnak wrote:
I need the output of a script to set a node value, from inside a cookbook. How would one do this?
You will have to call Chef::ShellOut (or something similar) from within a ruby_block resource.
--Noah
--
John Alberts