mitchellh/vagrant — pull request #2982 by ryanuber (2014-02-14 19:59:44+00:00)
Title: Shell provisioner fixnum args

In a recent Vagrant experiment, I was trying to take some options from ARGV and pass them in as arguments in the shell provisioner. I realized that if a `Fixnum` is passed, it falls through all of the cases, and just spews ruby exceptions:

```
/Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/plugins/provisioners/shell/provisioner.rb:61:in `quote_and_escape': undefined method `gsub' for 1:Fixnum (NoMethodError)
```

The following Vagrantfile would exhibit the failure:

```
Vagrant.configure(2) do |config|
config.vm.define 'testhost' do |h|
h.vm.box = 'precise64'
h.vm.box_url = "http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210.box"
h.vm.host_name = "blah"
h.vm.provision :shell, path: 'test.sh', args: [1]
end
end
```

This patch allows one to pass Fixnum arguments, and automatically have them converted to strings. It also adds a check for all elements in an array argument. This way, the user can't pass anything except for strings or Fixnums as elements in an array of args.