[chef] Re: Running knife commands in the background(using rc.local)


Chronological Thread 
  • From: Daniel DeLeo < >
  • To:
  • Subject: [chef] Re: Running knife commands in the background(using rc.local)
  • Date: Thu, 2 May 2013 09:34:03 -0700


On Thursday, May 2, 2013 at 12:48 AM, NagaLakshmi wrote:

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?
What's the failure? Can you modify your code to run knife with the -VV option and share the output?

-- 
Daniel DeLeo




Archive powered by MHonArc 2.6.16.

§