Test running shell scripts inline
This commit is contained in:
parent
6dbade0fc6
commit
9e4475cb77
|
@ -27,9 +27,12 @@ module Vagrant
|
||||||
end
|
end
|
||||||
|
|
||||||
# Validate the existence of a script to upload
|
# Validate the existence of a script to upload
|
||||||
|
if path
|
||||||
expanded_path = Pathname.new(path).expand_path(env.root_path)
|
expanded_path = Pathname.new(path).expand_path(env.root_path)
|
||||||
if path && !expanded_path.file?
|
if !expanded_path.file?
|
||||||
errors.add(I18n.t("vagrant.provisioners.shell.path_invalid", :path => expanded_path))
|
errors.add(I18n.t("vagrant.provisioners.shell.path_invalid",
|
||||||
|
:path => expanded_path))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# There needs to be a path to upload the script to
|
# There needs to be a path to upload the script to
|
||||||
|
|
|
@ -29,4 +29,25 @@ vf
|
||||||
result_file.exist?.should be
|
result_file.exist?.should be
|
||||||
result_file.read.should == "success\n"
|
result_file.read.should == "success\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "runs an inline script" do
|
||||||
|
require_box("default")
|
||||||
|
|
||||||
|
assert_execute("vagrant", "box", "add", "base", box_path("default"))
|
||||||
|
|
||||||
|
environment.workdir.join("Vagrantfile").open("w+") do |f|
|
||||||
|
f.write(<<-vf)
|
||||||
|
Vagrant::Config.run do |config|
|
||||||
|
config.vm.box = "base"
|
||||||
|
config.vm.provision :shell, :inline => "echo success > /vagrant/results"
|
||||||
|
end
|
||||||
|
vf
|
||||||
|
end
|
||||||
|
|
||||||
|
assert_execute("vagrant", "up")
|
||||||
|
|
||||||
|
result_file = environment.workdir.join("results")
|
||||||
|
result_file.exist?.should be
|
||||||
|
result_file.read.should == "success\n"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue