diff --git a/plugins/provisioners/shell/config.rb b/plugins/provisioners/shell/config.rb index c0b0b7cf2..2c98468b2 100644 --- a/plugins/provisioners/shell/config.rb +++ b/plugins/provisioners/shell/config.rb @@ -29,6 +29,10 @@ module VagrantPlugins @privileged = true if @privileged == UNSET_VALUE @binary = false if @binary == UNSET_VALUE @keep_color = false if @keep_color == UNSET_VALUE + + if @args && !@args.is_a?(Array) && args_valid? + @args = @args.to_s + end end def validate(machine) @@ -66,11 +70,13 @@ module VagrantPlugins # string or as an array. def args_valid? return true if !args - return true if args.is_a?(String) or args.is_a?(Fixnum) + return true if args.is_a?(String) + return true if args.is_a?(Fixnum) if args.is_a?(Array) args.each do |a| - return false if not a.kind_of?(String) and not a.kind_of?(Fixnum) + return false if !a.kind_of?(String) && !a.kind_of?(Fixnum) end + return true end end diff --git a/plugins/provisioners/shell/provisioner.rb b/plugins/provisioners/shell/provisioner.rb index 04ee3c8ef..3eb442d18 100644 --- a/plugins/provisioners/shell/provisioner.rb +++ b/plugins/provisioners/shell/provisioner.rb @@ -8,10 +8,10 @@ module VagrantPlugins class Provisioner < Vagrant.plugin("2", :provisioner) def provision args = "" - if config.args.is_a?(String) or config.args.is_a?(Fixnum) + if config.args.is_a?(String) args = " #{config.args.to_s}" elsif config.args.is_a?(Array) - args = config.args.map { |a| quote_and_escape(a.to_s) } + args = config.args.map { |a| quote_and_escape(a) } args = " #{args.join(" ")}" end