From 035d024daaedbe2c3a7b25e1508ddbdcf76ac81d Mon Sep 17 00:00:00 2001 From: John Dewey Date: Sun, 9 Apr 2017 21:12:16 -0700 Subject: [PATCH] Backported #787 to v2 --- molecule/driver/vagrant.py | 2 +- test/unit/driver/test_vagrant.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/molecule/driver/vagrant.py b/molecule/driver/vagrant.py index f4a77cb4e..b54cbcb0c 100644 --- a/molecule/driver/vagrant.py +++ b/molecule/driver/vagrant.py @@ -108,7 +108,7 @@ def ansible_connection_options(self, instance_name): 'ansible_user': d['User'], 'ansible_host': d['HostName'], 'ansible_port': d['Port'], - 'ansible_private_key_file': d['IdentityFile'], + 'ansible_private_key_file': '"{}"'.format(d['IdentityFile']), 'connection': 'ssh', 'ansible_ssh_extra_args': ' '.join(ssh_options), } diff --git a/test/unit/driver/test_vagrant.py b/test/unit/driver/test_vagrant.py index af5947a13..d88cd67f7 100644 --- a/test/unit/driver/test_vagrant.py +++ b/test/unit/driver/test_vagrant.py @@ -122,7 +122,7 @@ def test_ansible_connection_options(mocker, vagrant_instance): 'ansible_host': '127.0.0.1', 'ansible_port': 2222, 'ansible_user': 'vagrant', - 'ansible_private_key_file': '/foo/bar', + 'ansible_private_key_file': '"/foo/bar"', 'connection': 'ssh', 'ansible_ssh_extra_args': ('-o UserKnownHostsFile=/dev/null ' '-o ControlMaster=auto '