lib/vagrant/hosts/bsd.rb in vagrantup-0.5.4 vs lib/vagrant/hosts/bsd.rb in vagrantup-0.6.0
- old
+ new
@@ -1,21 +1,15 @@
module Vagrant
module Hosts
# Represents a BSD host, such as FreeBSD and Darwin (Mac OS X).
class BSD < Base
include Util
+ include Util::Retryable
def nfs?
- tries = 10
- begin
+ retryable(:tries => 10, :on => TypeError) do
system("which nfsd > /dev/null 2>&1")
- rescue TypeError
- tries -= 1
- retry if tries > 0
-
- # Hopefully this point isn't reached
- raise
end
end
def nfs_export(ip, folders)
output = TemplateRenderer.render('nfs/exports',
@@ -23,10 +17,10 @@
:ip => ip,
:folders => folders)
# The sleep ensures that the output is truly flushed before any `sudo`
# commands are issued.
- env.logger.info "Preparing to edit /etc/exports. Administrator priveleges will be required..."
+ env.ui.info I18n.t("vagrant.hosts.bsd.nfs_export.prepare")
sleep 0.5
output.split("\n").each do |line|
# This should only ask for administrative permission once, even
# though its executed in multiple subshells.