Run Chef commands in a single command [GH-390]
This commit is contained in:
parent
0cde5d2d46
commit
338b3ac094
|
@ -1,5 +1,6 @@
|
||||||
## 0.7.6 (unreleased)
|
## 0.7.6 (unreleased)
|
||||||
|
|
||||||
|
- Run Chef commands in a single command. [GH-390]
|
||||||
- Add `nfs` option for Chef to mount Chef folders via NFS. [GH-378]
|
- Add `nfs` option for Chef to mount Chef folders via NFS. [GH-378]
|
||||||
- Add translation for `aborted` state in VM. [GH-371]
|
- Add translation for `aborted` state in VM. [GH-371]
|
||||||
- Use full paths with the Chef provisioner so that restart cookbook will
|
- Use full paths with the Chef provisioner so that restart cookbook will
|
||||||
|
|
|
@ -79,14 +79,13 @@ module Vagrant
|
||||||
|
|
||||||
def run_chef_client
|
def run_chef_client
|
||||||
command_env = config.binary_env ? "#{config.binary_env} " : ""
|
command_env = config.binary_env ? "#{config.binary_env} " : ""
|
||||||
commands = ["cd #{config.provisioning_path}",
|
command = "#{command_env}#{chef_binary_path("chef-client")} -c #{config.provisioning_path}/client.rb -j #{config.provisioning_path}/dna.json"
|
||||||
"#{command_env}#{chef_binary_path("chef-client")} -c client.rb -j dna.json"]
|
|
||||||
|
|
||||||
env.ui.info I18n.t("vagrant.provisioners.chef.running_client")
|
env.ui.info I18n.t("vagrant.provisioners.chef.running_client")
|
||||||
vm.ssh.execute do |ssh|
|
vm.ssh.execute do |ssh|
|
||||||
ssh.sudo!(commands) do |channel, type, data|
|
ssh.sudo!(command) do |channel, type, data|
|
||||||
if type == :exit_status
|
if type == :exit_status
|
||||||
ssh.check_exit_status(data, commands)
|
ssh.check_exit_status(data, command)
|
||||||
else
|
else
|
||||||
env.ui.info("#{data}: #{type}")
|
env.ui.info("#{data}: #{type}")
|
||||||
end
|
end
|
||||||
|
|
|
@ -73,14 +73,13 @@ module Vagrant
|
||||||
|
|
||||||
def run_chef_solo
|
def run_chef_solo
|
||||||
command_env = config.binary_env ? "#{config.binary_env} " : ""
|
command_env = config.binary_env ? "#{config.binary_env} " : ""
|
||||||
commands = ["cd #{config.provisioning_path}",
|
command = "#{command_env}#{chef_binary_path("chef-solo")} -c #{config.provisioning_path}/solo.rb -j #{config.provisioning_path}/dna.json"
|
||||||
"#{command_env}#{chef_binary_path("chef-solo")} -c #{config.provisioning_path}/solo.rb -j #{config.provisioning_path}/dna.json"]
|
|
||||||
|
|
||||||
env.ui.info I18n.t("vagrant.provisioners.chef.running_solo")
|
env.ui.info I18n.t("vagrant.provisioners.chef.running_solo")
|
||||||
vm.ssh.execute do |ssh|
|
vm.ssh.execute do |ssh|
|
||||||
ssh.sudo!(commands) do |channel, type, data|
|
ssh.sudo!(command) do |channel, type, data|
|
||||||
if type == :exit_status
|
if type == :exit_status
|
||||||
ssh.check_exit_status(data, commands)
|
ssh.check_exit_status(data, command)
|
||||||
else
|
else
|
||||||
env.ui.info("#{data}: #{type}")
|
env.ui.info("#{data}: #{type}")
|
||||||
end
|
end
|
||||||
|
|
|
@ -175,8 +175,8 @@ class ChefServerProvisionerTest < Test::Unit::TestCase
|
||||||
@vm.ssh.stubs(:execute).yields(@ssh)
|
@vm.ssh.stubs(:execute).yields(@ssh)
|
||||||
end
|
end
|
||||||
|
|
||||||
should "cd into the provisioning directory and run chef client" do
|
should "run chef client" do
|
||||||
@ssh.expects(:sudo!).with(["cd #{@config.provisioning_path}", "chef-client -c client.rb -j dna.json"]).once
|
@ssh.expects(:sudo!).with("chef-client -c #{@config.provisioning_path}/client.rb -j #{@config.provisioning_path}/dna.json").once
|
||||||
@action.run_chef_client
|
@action.run_chef_client
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -249,8 +249,8 @@ class ChefSoloProvisionerTest < Test::Unit::TestCase
|
||||||
@vm.ssh.stubs(:execute).yields(@ssh)
|
@vm.ssh.stubs(:execute).yields(@ssh)
|
||||||
end
|
end
|
||||||
|
|
||||||
should "cd into the provisioning directory and run chef solo" do
|
should "run chef solo" do
|
||||||
@ssh.expects(:sudo!).with(["cd #{@config.provisioning_path}", "chef-solo -c #{@config.provisioning_path}/solo.rb -j #{@config.provisioning_path}/dna.json"]).once
|
@ssh.expects(:sudo!).with("chef-solo -c #{@config.provisioning_path}/solo.rb -j #{@config.provisioning_path}/dna.json").once
|
||||||
@action.run_chef_solo
|
@action.run_chef_solo
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue