Args can now be specified to the shell provisioner [closes GH-475]

This commit is contained in:
Mitchell Hashimoto 2011-08-28 00:01:23 -07:00
parent 0f0cb27e50
commit bf32fb4de8
3 changed files with 17 additions and 1 deletions

View File

@ -2,6 +2,7 @@
- Fix issue with download progress not properly clearing the line. [GH-476]
- NFS should work properly on Fedora. [GH-450]
- Arguments can be specified to the `shell` provisioner via the `args` option. [GH-475]
## 0.8.5 (August 15, 2011)

View File

@ -7,11 +7,13 @@ module Vagrant
attr_accessor :inline
attr_accessor :path
attr_accessor :upload_path
attr_accessor :args
def initialize
@inline = nil
@path = nil
@upload_path = "/tmp/vagrant-shell"
@args = nil
end
def expanded_path
@ -64,7 +66,9 @@ module Vagrant
end
def provision!
commands = ["chmod +x #{config.upload_path}", config.upload_path]
args = ""
args = " #{config.args}" if config.args
commands = ["chmod +x #{config.upload_path}", "#{config.upload_path}#{args}"]
with_script_file do |path|
# Upload the script to the VM

View File

@ -64,5 +64,16 @@ class ShellProvisionerTest < Test::Unit::TestCase
@action.provision!
end
should "append arguments if provided" do
@config.args = "foo bar baz"
commands = ["chmod +x #{@config.upload_path}", "#{@config.upload_path} #{@config.args}"]
p_seq = sequence("provisioning")
@action.vm.ssh.expects(:upload!).with(@config.expanded_path.to_s, @config.upload_path).in_sequence(p_seq)
@ssh.expects(:sudo!).with(commands).in_sequence(p_seq)
@action.provision!
end
end
end