summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Belchamber <james@belchamber.com>2014-08-11 18:07:19 +0100
committerLamont Granquist <lamont@scriptkiddie.org>2015-08-18 12:13:23 -0700
commit43620a7e3d663ca83bc4394a5baaf724fecf06d8 (patch)
tree9cc43e6d1a78da2edaa622ad7c890551811ae341
parent457cba5aab3cb15435e4cc5c3fd47b0669eee159 (diff)
downloadchef-43620a7e3d663ca83bc4394a5baaf724fecf06d8.tar.gz
mount now remounts if options change
-rw-r--r--lib/chef/provider/mount.rb32
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