From 6db1afff04427fdb3e722799d3fffbaac9cebe9c Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 9 Sep 2010 00:37:54 -0700 Subject: [PATCH] Get rid of redundant retries, switch to retryable --- lib/vagrant/hosts/bsd.rb | 10 ++-------- lib/vagrant/hosts/linux.rb | 10 ++-------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/lib/vagrant/hosts/bsd.rb b/lib/vagrant/hosts/bsd.rb index 655cf237d..7d63c4b91 100644 --- a/lib/vagrant/hosts/bsd.rb +++ b/lib/vagrant/hosts/bsd.rb @@ -3,17 +3,11 @@ module Vagrant # 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 diff --git a/lib/vagrant/hosts/linux.rb b/lib/vagrant/hosts/linux.rb index 816a63e20..1d9706f2d 100644 --- a/lib/vagrant/hosts/linux.rb +++ b/lib/vagrant/hosts/linux.rb @@ -3,18 +3,12 @@ module Vagrant # Represents a Linux based host, such as Ubuntu. class Linux < Base include Util + include Util::Retryable def nfs? - tries = 10 - begin + retryable(:tries => 10, :on => TypeError) do # Check procfs to see if NFSd is a supported filesystem 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