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]
|
- Fix issue with download progress not properly clearing the line. [GH-476]
|
||||||
- NFS should work properly on Fedora. [GH-450]
|
- 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)
|
## 0.8.5 (August 15, 2011)
|
||||||
|
|
||||||
|
|
|
@ -7,11 +7,13 @@ module Vagrant
|
||||||
attr_accessor :inline
|
attr_accessor :inline
|
||||||
attr_accessor :path
|
attr_accessor :path
|
||||||
attr_accessor :upload_path
|
attr_accessor :upload_path
|
||||||
|
attr_accessor :args
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
@inline = nil
|
@inline = nil
|
||||||
@path = nil
|
@path = nil
|
||||||
@upload_path = "/tmp/vagrant-shell"
|
@upload_path = "/tmp/vagrant-shell"
|
||||||
|
@args = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def expanded_path
|
def expanded_path
|
||||||
|
@ -64,7 +66,9 @@ module Vagrant
|
||||||
end
|
end
|
||||||
|
|
||||||
def provision!
|
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|
|
with_script_file do |path|
|
||||||
# Upload the script to the VM
|
# Upload the script to the VM
|
||||||
|
|
|
@ -64,5 +64,16 @@ class ShellProvisionerTest < Test::Unit::TestCase
|
||||||
|
|
||||||
@action.provision!
|
@action.provision!
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue