Get rid of redundant retries, switch to retryable

This commit is contained in:
Mitchell Hashimoto 2010-09-09 00:37:54 -07:00
parent ea35608f64
commit 6db1afff04
2 changed files with 4 additions and 16 deletions

View File

@ -3,17 +3,11 @@ module Vagrant
# Represents a BSD host, such as FreeBSD and Darwin (Mac OS X). # Represents a BSD host, such as FreeBSD and Darwin (Mac OS X).
class BSD < Base class BSD < Base
include Util include Util
include Util::Retryable
def nfs? def nfs?
tries = 10 retryable(:tries => 10, :on => TypeError) do
begin
system("which nfsd > /dev/null 2>&1") system("which nfsd > /dev/null 2>&1")
rescue TypeError
tries -= 1
retry if tries > 0
# Hopefully this point isn't reached
raise
end end
end end

View File

@ -3,18 +3,12 @@ module Vagrant
# Represents a Linux based host, such as Ubuntu. # Represents a Linux based host, such as Ubuntu.
class Linux < Base class Linux < Base
include Util include Util
include Util::Retryable
def nfs? def nfs?
tries = 10 retryable(:tries => 10, :on => TypeError) do
begin
# Check procfs to see if NFSd is a supported filesystem # Check procfs to see if NFSd is a supported filesystem
system("cat /proc/filesystems | grep nfsd > /dev/null 2>&1") system("cat /proc/filesystems | grep nfsd > /dev/null 2>&1")
rescue TypeError
tries -= 1
retry if tries > 0
# Hopefully this point isn't reached
raise
end end
end end