diff options
author | James Belchamber <james@belchamber.com> | 2014-08-11 18:07:19 +0100 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2015-08-18 12:13:23 -0700 |
commit | 43620a7e3d663ca83bc4394a5baaf724fecf06d8 (patch) | |
tree | 9cc43e6d1a78da2edaa622ad7c890551811ae341 | |
parent | 457cba5aab3cb15435e4cc5c3fd47b0669eee159 (diff) | |
download | chef-43620a7e3d663ca83bc4394a5baaf724fecf06d8.tar.gz |
mount now remounts if options change
-rw-r--r-- | lib/chef/provider/mount.rb | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/lib/chef/provider/mount.rb b/lib/chef/provider/mount.rb index 2039e9ae51..e45d13843a 100644 --- a/lib/chef/provider/mount.rb +++ b/lib/chef/provider/mount.rb @@ -42,7 +42,7 @@ class Chef end def action_mount - unless current_resource.mounted + unless current_resource.mounted && mount_options_unchanged? converge_by("mount #{current_resource.device} to #{current_resource.mount_point}") do mount_fs Chef::Log.info("#{new_resource} mounted") @@ -52,6 +52,36 @@ class Chef end end + def action_mount + if current_resource.mounted + if mount_options_unchanged? + Chef::Log.debug("#{new_resource} is already mounted") + else + if new_resource.supports[:remount] + converge_by("remount #{current_resource.device}") do + remount_fs + Chef::Log.info("#{new_resource} remounted") + end + else + converge_by("unmount #{current_resource.device}") do + umount_fs + Chef::Log.info("#{new_resource} unmounted") + end + wait_until_unmounted(unmount_retries) + converge_by("mount #{current_resource.device}") do + mount_fs + Chef::Log.info("#{new_resource} mounted") + end + end + end + else + converge_by("mount #{current_resource.device} to #{current_resource.mount_point}") do + mount_fs + Chef::Log.info("#{new_resource} mounted") + end + end + end + def action_umount if current_resource.mounted converge_by("unmount #{current_resource.device}") do |