- From: NagaLakshmi <
>
- To:
- Subject: [chef-dev] Running knife commands in the background(using rc.local)
- Date: Thu, 2 May 2013 00:49:38 -0700 (PDT)
Hi,
I've written a rack application using grape which calls knife's bootstrap
command to bootstrap a VM.The following is the code to bootstrap
module Chef
class Bootstrap < Grape::API
format :json
content_type :json,"application/json"
params do
requires :VM_IP, :type => String, :desc => "ip value"
requires :VM_username, :type => String, :desc => "username"
requires :VM_password, :type => String, :desc => "password"
end
resource :virtualmachine
post 'bootstrap' do
content_type "application/json"
status "200"
body "Boostrapped Successfully!!!"
t1 = Thread.new do
system "knife chefsolo bootstrap #{params[:VM_IP]} -x
#{params[:VM_username]} -P '#{params[:VM_password]}'"
end
end
end
end
end
When i start the app manually using "rackup -p 9000 config.ru",the above code
is working fine,I've added this command to /etc/rc.local file to start the
service during startup. The service has been started successfully but
bootstrapping is not working. I've tried replacing the knife commands with
other system commands and those are working fine.Only knife commands are not
working when i start the service in the background.Is there any specific
reason
for it?How can i modify the code to make that working?
- [chef-dev] Running knife commands in the background(using rc.local), NagaLakshmi, 05/02/2013
Archive powered by MHonArc 2.6.16.