- From: Bryan McLellan <
>
- To:
- Subject: [chef] Re: how could I use knife programmatically in a ruby script?
- Date: Wed, 23 Nov 2011 12:24:20 -0500
On Wed, Nov 23, 2011 at 12:14 PM, Bryan Berry
<
>
wrote:
>
Instead of shelling out to knife each time, could I just require 'Chef',
>
initialize a few values, and work from there?
You could use Chef as a library. Some people use knife as a library,
which is discouraged because it is a client that uses the chef library
itself, but I understand why.
For something simple like this, you should use 'knife exec'
http://wiki.opscode.com/display/chef/Knife+Exec
http://blog.loftninjas.org/2010/12/29/knife-one-liners/
http://blog.loftninjas.org/2011/01/12/knife-reporting-apt-updates/
Bryan
Archive powered by MHonArc 2.6.16.