Always clean the NFS exports

This commit is contained in:
Mitchell Hashimoto 2012-01-12 18:48:47 -08:00
parent 7dc5f8ca80
commit de450f7e63
2 changed files with 7 additions and 14 deletions

View File

@ -56,9 +56,6 @@ module Vagrant
return if !File.exist?("/etc/exports") return if !File.exist?("/etc/exports")
retryable(:tries => 10, :on => TypeError) do retryable(:tries => 10, :on => TypeError) do
system("cat /etc/exports | grep 'VAGRANT-BEGIN: #{id}' > /dev/null 2>&1")
if $?.to_i == 0
# Use sed to just strip out the block of code which was inserted # Use sed to just strip out the block of code which was inserted
# by Vagrant, and restart NFS. # by Vagrant, and restart NFS.
system("sudo sed -e '/^# VAGRANT-BEGIN: #{id}/,/^# VAGRANT-END: #{id}/ d' -ibak /etc/exports") system("sudo sed -e '/^# VAGRANT-BEGIN: #{id}/,/^# VAGRANT-END: #{id}/ d' -ibak /etc/exports")
@ -68,4 +65,3 @@ module Vagrant
end end
end end
end end
end

View File

@ -52,9 +52,7 @@ module Vagrant
def nfs_cleanup(id) def nfs_cleanup(id)
return if !File.exist?("/etc/exports") return if !File.exist?("/etc/exports")
system("cat /etc/exports | grep 'VAGRANT-BEGIN: #{id}' > /dev/null 2>&1")
if $?.to_i == 0
# Use sed to just strip out the block of code which was inserted # Use sed to just strip out the block of code which was inserted
# by Vagrant # by Vagrant
system("sudo sed -e '/^# VAGRANT-BEGIN: #{id}/,/^# VAGRANT-END: #{id}/ d' -ibak /etc/exports") system("sudo sed -e '/^# VAGRANT-BEGIN: #{id}/,/^# VAGRANT-END: #{id}/ d' -ibak /etc/exports")
@ -62,4 +60,3 @@ module Vagrant
end end
end end
end end
end