provisioners/ansible: Add example of `host_vars` values that include quotes

Motivated by the support effort on GH-8158 ;-)
This commit is contained in:
Gilles Cornu 2016-12-28 23:20:49 +01:00
parent a3b9d231ad
commit 9493901e0c
No known key found for this signature in database
GPG Key ID: F6BC2CF7E1FE8FFF
2 changed files with 3 additions and 2 deletions

View File

@ -292,11 +292,11 @@ VF
it "adds host variables (given in Hash format) to the generated inventory" do it "adds host variables (given in Hash format) to the generated inventory" do
config.host_vars = { config.host_vars = {
machine1: {"http_port" => 80, "maxRequestsPerChild" => 808} machine1: {"http_port" => 80, "comments" => "'some text with spaces'"}
} }
expect(Vagrant::Util::Subprocess).to receive(:execute).with { |*args| expect(Vagrant::Util::Subprocess).to receive(:execute).with { |*args|
inventory_content = File.read(generated_inventory_file) inventory_content = File.read(generated_inventory_file)
expect(inventory_content).to match("^" + Regexp.quote(machine.name) + ".+http_port=80 maxRequestsPerChild=808") expect(inventory_content).to match("^" + Regexp.quote(machine.name) + ".+http_port=80 comments='some text with spaces'$")
} }
end end

View File

@ -93,6 +93,7 @@ Some of these options are for advanced usage only and should not be used unless
ansible.host_vars = { ansible.host_vars = {
"host1" => {"http_port" => 80, "host1" => {"http_port" => 80,
"maxRequestsPerChild" => 808}, "maxRequestsPerChild" => 808},
"comments" => "'text with spaces'",
"host2" => {"http_port" => 303, "host2" => {"http_port" => 303,
"maxRequestsPerChild" => 909} "maxRequestsPerChild" => 909}
} }