From bf7c34ab9d8fd43242ca280969b08075869d1b3f Mon Sep 17 00:00:00 2001 From: Tomoyuki Sakurai Date: Tue, 4 Oct 2016 22:05:45 +0900 Subject: [PATCH] see if `%` is replaced with `%%` --- .../provisioners/ansible/provisioner_test.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/unit/plugins/provisioners/ansible/provisioner_test.rb b/test/unit/plugins/provisioners/ansible/provisioner_test.rb index 83b96538d..56dd43618 100644 --- a/test/unit/plugins/provisioners/ansible/provisioner_test.rb +++ b/test/unit/plugins/provisioners/ansible/provisioner_test.rb @@ -678,6 +678,20 @@ VF end end + describe "with an identity file containing `%`" do + before do + ssh_info[:private_key_path] = ['/foo%bar/key', '/bar%%buz/key'] + end + + it "replaces `%` with `%%`" do + expect(Vagrant::Util::Subprocess).to receive(:execute).with { |*args| + cmd_opts = args.last + expect(cmd_opts[:env]['ANSIBLE_SSH_ARGS']).to include("-o 'IdentityFile=/foo%%bar/key'") + expect(cmd_opts[:env]['ANSIBLE_SSH_ARGS']).to include("-o 'IdentityFile=/bar%%%%buz/key'") + } + end + end + describe "with ssh forwarding enabled" do before do ssh_info[:forward_agent] = true