provisioners/ansible: properly quote vars with spaces [GH-1984]
This commit is contained in:
parent
471dc2dc7d
commit
d237bc0657
|
@ -14,7 +14,7 @@ IMPROVEMENTS:
|
|||
- commands/status: cosmetic improvement to better align names and
|
||||
statuses [GH-2016]
|
||||
- guests/suse: Supports private/public networks. [GH-1689]
|
||||
- plugins/ansible: Ansible `inventory_path` can be a directory now. [GH-2035]
|
||||
- provisioners/ansible: Ansible `inventory_path` can be a directory now. [GH-2035]
|
||||
|
||||
BUG FIXES:
|
||||
|
||||
|
@ -23,6 +23,7 @@ BUG FIXES:
|
|||
[GH-2026]
|
||||
- hosts/fedora: properly detect later CentOS versions. [GH-2008]
|
||||
- provisioners/ansible: No longer report failure on every run. [GH-2007]
|
||||
- provisioners/ansible: Properly handle extra vars with spaces. [GH-1984]
|
||||
|
||||
## 1.2.7 (July 28, 2013)
|
||||
|
||||
|
|
|
@ -5,10 +5,23 @@ module VagrantPlugins
|
|||
ssh = @machine.ssh_info
|
||||
|
||||
options = %W[--private-key=#{ssh[:private_key_path]} --user=#{ssh[:username]}]
|
||||
options << "--extra-vars=" + config.extra_vars.map{|k,v| "#{k}=#{v}"}.join(' ') if config.extra_vars
|
||||
options << "--inventory-file=#{config.inventory_path}" if config.inventory_path
|
||||
options << "--ask-sudo-pass" if config.ask_sudo_pass
|
||||
|
||||
if config.extra_vars
|
||||
extra_vars = config.extra_vars.map do |k,v|
|
||||
v = v.gsub('"', '\\"')
|
||||
if v.include?(' ')
|
||||
v = v.gsub("'", "\\'")
|
||||
v = "'#{v}'"
|
||||
end
|
||||
|
||||
"#{k}=#{v}"
|
||||
end
|
||||
|
||||
options << "--extra-vars=\"#{extra_vars.join(" ")}\""
|
||||
end
|
||||
|
||||
if config.limit
|
||||
if not config.limit.kind_of?(Array)
|
||||
config.limit = [config.limit]
|
||||
|
|
Loading…
Reference in New Issue