diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2014-05-27 11:18:37 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2014-05-28 16:59:27 -0700 |
commit | d8f99d114fc1f8dd2968d353e9aadd82e78fede7 (patch) | |
tree | f044df3f9b90eafb7c1cf3fecf41aa858a962173 | |
parent | eecd604b754817ca51a229e597e62230ffe609cc (diff) | |
download | chef-d8f99d114fc1f8dd2968d353e9aadd82e78fede7.tar.gz |
don't infinite loop on umounting the filesystem
-rw-r--r-- | lib/chef/provider/mount.rb | 13 |
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 |