From 9493901e0cb5f93c2cf020ff07e9a98a182b3007 Mon Sep 17 00:00:00 2001 From: Gilles Cornu Date: Wed, 28 Dec 2016 23:20:49 +0100 Subject: [PATCH] provisioners/ansible: Add example of `host_vars` values that include quotes Motivated by the support effort on GH-8158 ;-) --- test/unit/plugins/provisioners/ansible/provisioner_test.rb | 4 ++-- website/source/docs/provisioning/ansible_common.html.md | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/test/unit/plugins/provisioners/ansible/provisioner_test.rb b/test/unit/plugins/provisioners/ansible/provisioner_test.rb index db562201d..2c8c27fb4 100644 --- a/test/unit/plugins/provisioners/ansible/provisioner_test.rb +++ b/test/unit/plugins/provisioners/ansible/provisioner_test.rb @@ -292,11 +292,11 @@ VF it "adds host variables (given in Hash format) to the generated inventory" do 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| 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 diff --git a/website/source/docs/provisioning/ansible_common.html.md b/website/source/docs/provisioning/ansible_common.html.md index 2ed3b4e72..d53639613 100644 --- a/website/source/docs/provisioning/ansible_common.html.md +++ b/website/source/docs/provisioning/ansible_common.html.md @@ -93,6 +93,7 @@ Some of these options are for advanced usage only and should not be used unless ansible.host_vars = { "host1" => {"http_port" => 80, "maxRequestsPerChild" => 808}, + "comments" => "'text with spaces'", "host2" => {"http_port" => 303, "maxRequestsPerChild" => 909} }