- From: Haim Ashkenazi <
>
- To:
- Subject: [chef] Running knife bootstrap programatically
- Date: Wed, 3 Aug 2011 12:31:38 +0300
Hi
I was wondering if there's a way to run knife bootstrap not as a command, but as API call? (Sorry if it's already been answered but it's really hard to search the mailing list).
I tried using something simple like (ignore the redefinition of ARGV :):
require 'chef/knife/bootstrap'
ARGV = ["some.host", "-x", "ubuntu", "-r", "role[test]", "--sudo"]
Chef::Knife::Bootstrap.new.run
Running this I got an error:
/Users/haim/.rvm/gems/
/gems/chef-0.10.2/lib/chef/knife/core/ui.rb:96: warning: toplevel constant Config referenced by Chef::Config
/Users/haim/.rvm/gems/
/gems/chef-0.10.2/lib/chef/knife/core/ui.rb:96:in `color?': undefined method `[]' for Config:Module (NoMethodError)
from /Users/haim/.rvm/gems/
/gems/chef-0.10.2/lib/chef/knife/core/ui.rb:85:in `color'
from /Users/haim/.rvm/gems/
/gems/chef-0.10.2/lib/chef/knife/core/ui.rb:76:in `error'
from /Users/haim/.rvm/gems/
/gems/chef-0.10.2/lib/chef/knife/bootstrap.rb:158:in `validate_name_args!'
from /Users/haim/.rvm/gems/
/gems/chef-0.10.2/lib/chef/knife/bootstrap.rb:137:in `run'
from test.rb:4
Is there any easy way to run it?
Thanks in advance
--
Haim
- [chef] Running knife bootstrap programatically, Haim Ashkenazi, 08/03/2011
Archive powered by MHonArc 2.6.16.