Args can now be specified to the shell provisioner [closes GH-475]
This commit is contained in:
parent
0f0cb27e50
commit
bf32fb4de8
|
@ -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)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue