summaryrefslogtreecommitdiff
path: root/lib/chef/provider/mount.rb
diff options
context:
space:
mode:
authorThom May <thom@chef.io>2018-03-09 18:28:47 +0000
committerThom May <thom@chef.io>2018-03-14 16:29:48 +0000
commit61e3d4bb382da5a0f6c09dd144ce4c6fc96c3ca9 (patch)
treec83baedaba2f265ebc85a4be907ad2c0ea0c26a8 /lib/chef/provider/mount.rb
parentf1c97d18f68b01e8f82757bbb1111ca82d4fba99 (diff)
downloadchef-61e3d4bb382da5a0f6c09dd144ce4c6fc96c3ca9.tar.gz
update mount to use properties and fix 6851
Signed-off-by: Thom May <thom@chef.io>
Diffstat (limited to 'lib/chef/provider/mount.rb')
-rw-r--r--lib/chef/provider/mount.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/chef/provider/mount.rb b/lib/chef/provider/mount.rb
index 4d0d273ea9..533dd2514b 100644
--- a/lib/chef/provider/mount.rb
+++ b/lib/chef/provider/mount.rb
@@ -83,7 +83,7 @@ class Chef
end
def action_enable
- unless current_resource.enabled && mount_options_unchanged?
+ unless current_resource.enabled && mount_options_unchanged? && device_unchanged?
converge_by("enable #{current_resource.device}") do
enable_fs
Chef::Log.info("#{new_resource} enabled")
@@ -120,6 +120,14 @@ class Chef
raise Chef::Exceptions::UnsupportedAction, "#{self} does not implement #mount_options_unchanged?"
end
+ # It's entirely plausible that a site might prefer UUIDs or labels, so
+ # we need to be able to update fstab to conform with their wishes
+ # without necessarily needing to remount the device.
+ # See #6851 for more.
+ def device_unchanged?
+ @current_resource.device == @new_resource.device
+ end
+
#
# NOTE: for the following methods, this superclass will already have checked if the filesystem is
# enabled and/or mounted and they will be called in converge_by blocks, so most defensive checking