From e113d1ccabb50c89034d52868bd36015b6006f4b Mon Sep 17 00:00:00 2001
From: Markos Chandras <mchandras@suse.de>
Date: Wed, 11 Apr 2018 16:59:11 +0100
Subject: [PATCH] Vagrantfile: Use rsync to copy working directory to VM

Depending on the VM configuration, vagrant may either use 'rsync' or
vboxfs for populating the working directory to the VM. However, vboxfs
means that any files created by the VM will also be present on the host.
As such, lets be explicit and always use 'rsync' to copy the directory
to the VM so we can keep the host copy clean. Moreover, the default
rsync options include '--copy-links' and this breaks rsync if there are
missing symlinks in the working directory like the following one:

Error: symlink has no referent:
"/home/user/kubespray/contrib/network-storage/glusterfs/group_vars"

As such, we override the default options to drop --copy-links.
---
 Vagrantfile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Vagrantfile b/Vagrantfile
index 0b86f7eda..cf174ef77 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -86,7 +86,6 @@ Vagrant.configure("2") do |config|
   if Vagrant.has_plugin?("vagrant-vbguest") then
     config.vbguest.auto_update = false
   end
-
   (1..$num_instances).each do |i|
     config.vm.define vm_name = "%s-%02d" % [$instance_name_prefix, i] do |config|
       config.vm.hostname = vm_name
@@ -112,8 +111,10 @@ Vagrant.configure("2") do |config|
         end
       end
 
+      config.vm.synced_folder ".", "/vagrant", type: "rsync", rsync__args: ['--verbose', '--archive', '--delete', '-z']
+
       $shared_folders.each do |src, dst|
-        config.vm.synced_folder src, dst
+        config.vm.synced_folder src, dst, type: "rsync", rsync__args: ['--verbose', '--archive', '--delete', '-z']
       end
 
       config.vm.provider :virtualbox do |vb|
-- 
GitLab