Chef solo is run now

This commit is contained in:
Mitchell Hashimoto 2010-02-09 19:22:12 -08:00
parent 4a6d6074d2
commit 337b5fc0f0
2 changed files with 21 additions and 0 deletions

View File

@ -14,6 +14,7 @@ module Hobo
chown_provisioning_folder
setup_json
setup_solo_config
run_chef_solo
end
def chown_provisioning_folder
@ -38,6 +39,17 @@ solo
SSH.upload!(StringIO.new(solo_file), File.join(Hobo.config.chef.provisioning_path, "solo.rb"))
end
def run_chef_solo
logger.info "Running chef recipes..."
SSH.execute do |ssh|
ssh.exec!("cd #{Hobo.config.chef.provisioning_path} && sudo chef-solo -c solo.rb -j dna.json") do |channel, data, stream|
# TODO: Very verbose. It would be easier to save the data and only show it during
# an error, or when verbosity level is set high
logger.info("#{stream}: #{data}")
end
end
end
def cookbooks_path
File.join(Hobo.config.chef.provisioning_path, "cookbooks")
end

View File

@ -68,4 +68,13 @@ config
@prov.setup_solo_config
end
end
context "running chef solo" do
should "cd into the provisioning directory and run chef solo" do
ssh = mock("ssh")
ssh.expects(:exec!).with("cd #{Hobo.config.chef.provisioning_path} && sudo chef-solo -c solo.rb -j dna.json").once
Hobo::SSH.expects(:execute).yields(ssh)
@prov.run_chef_solo
end
end
end