diff --git a/lib/vagrant/hosts/bsd.rb b/lib/vagrant/hosts/bsd.rb index 9bf3f2310..ef465fae1 100644 --- a/lib/vagrant/hosts/bsd.rb +++ b/lib/vagrant/hosts/bsd.rb @@ -35,12 +35,15 @@ module Vagrant def nfs_cleanup return if !File.exist?("/etc/exports") - system("cat /etc/exports | grep 'VAGRANT-BEGIN: #{env.vm.uuid}' > /dev/null 2>&1") - if $?.to_i == 0 - # Use sed to just strip out the block of code which was inserted - # by Vagrant - system("sudo sed -e '/^# VAGRANT-BEGIN: #{env.vm.uuid}/,/^# VAGRANT-END: #{env.vm.uuid}/ d' -i bak /etc/exports") + retryable(:tries => 10, :on => TypeError) do + system("cat /etc/exports | grep 'VAGRANT-BEGIN: #{env.vm.uuid}' > /dev/null 2>&1") + + if $?.to_i == 0 + # Use sed to just strip out the block of code which was inserted + # by Vagrant + system("sudo sed -e '/^# VAGRANT-BEGIN: #{env.vm.uuid}/,/^# VAGRANT-END: #{env.vm.uuid}/ d' -i bak /etc/exports") + end end end end