summaryrefslogtreecommitdiff
path: root/lib/chef/provider/mount.rb
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2014-05-27 11:18:37 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2014-05-28 16:59:27 -0700
commitd8f99d114fc1f8dd2968d353e9aadd82e78fede7 (patch)
treef044df3f9b90eafb7c1cf3fecf41aa858a962173 /lib/chef/provider/mount.rb
parenteecd604b754817ca51a229e597e62230ffe609cc (diff)
downloadchef-d8f99d114fc1f8dd2968d353e9aadd82e78fede7.tar.gz
don't infinite loop on umounting the filesystem
Diffstat (limited to 'lib/chef/provider/mount.rb')
-rw-r--r--lib/chef/provider/mount.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/chef/provider/mount.rb b/lib/chef/provider/mount.rb
index 34b924d3c6..c80855c5a7 100644
--- a/lib/chef/provider/mount.rb
+++ b/lib/chef/provider/mount.rb
@@ -69,7 +69,7 @@ class Chef
umount_fs
Chef::Log.info("#{new_resource} unmounted")
end
- sleep 0.1 while mounted?
+ wait_until_unmounted
converge_by("mount #{current_resource.device}") do
mount_fs
Chef::Log.info("#{new_resource} mounted")
@@ -147,6 +147,17 @@ class Chef
def disable_fs
raise Chef::Exceptions::UnsupportedAction, "#{self.to_s} does not support :disable"
end
+
+ private
+
+ def wait_until_unmounted(tries = 20)
+ while mounted?
+ if (tries -= 1) == 0
+ raise Chef::Exceptions::Mount, "Retries exceeded waiting for filesystem to unmount"
+ end
+ sleep 0.1
+ end
+ end
end
end
end