diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2014-05-22 17:23:32 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2014-05-28 16:59:26 -0700 |
commit | bfd2f20c2806afc54f59a36e81bf4db9fc2a33b3 (patch) | |
tree | 8a7655372772e7d167a38b42b2d852859ab72ee4 | |
parent | fbec96824cf55a7f8b99bc2c8bd8af38e414733e (diff) | |
download | chef-bfd2f20c2806afc54f59a36e81bf4db9fc2a33b3.tar.gz |
make umount/mount style remount possible
the subclasses have code that clearly wants to do this, but since
we never call remount_fs when the resource doesn't support remount
the code in remount_fs to handle when the resource doesn't support
remount is inaccessible code.
-rw-r--r-- | lib/chef/provider/mount.rb | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/chef/provider/mount.rb b/lib/chef/provider/mount.rb index 57380ab80e..a4fa330209 100644 --- a/lib/chef/provider/mount.rb +++ b/lib/chef/provider/mount.rb @@ -38,7 +38,7 @@ class Chef def action_mount unless @current_resource.mounted converge_by("mount #{@current_resource.device} to #{@current_resource.mount_point}") do - mount_fs() + mount_fs Chef::Log.info("#{@new_resource} mounted") end else @@ -49,7 +49,7 @@ class Chef def action_umount if @current_resource.mounted converge_by("unmount #{@current_resource.device}") do - umount_fs() + umount_fs Chef::Log.info("#{@new_resource} unmounted") end else @@ -58,17 +58,21 @@ class Chef end def action_remount - unless @new_resource.supports[:remount] - raise Chef::Exceptions::UnsupportedAction, "#{self.to_s} does not support :remount" - else - if @current_resource.mounted + if @current_resource.mounted + if @new_resource.supports[:remount] converge_by("remount #{@current_resource.device}") do - remount_fs() + remount_fs Chef::Log.info("#{@new_resource} remounted") end else - Chef::Log.debug("#{@new_resource} not mounted, nothing to remount") + umount_fs + Chef::Log.info("#{@new_resource} unmounted") + sleep 1 + mount_fs + Chef::Log.info("#{@new_resource} mounted") end + else + Chef::Log.debug("#{@new_resource} not mounted, nothing to remount") end end |