diff options
author | antima-gupta <agupta@msystechnologies.com> | 2020-10-28 17:32:29 +0530 |
---|---|---|
committer | antima-gupta <agupta@msystechnologies.com> | 2020-10-28 17:32:29 +0530 |
commit | 7fe69a2a865e24314540e2c8a9c0d28375b22eed (patch) | |
tree | 4d23df7aeb6bd0f70b795edfea5818db1140d3fc /lib/chef/provider | |
parent | a8ead1a6bbbbda2eae75bc1fdc4c9858d15c81cb (diff) | |
download | chef-7fe69a2a865e24314540e2c8a9c0d28375b22eed.tar.gz |
Moved device_fstab method from provider/mount/mount.rb to provider/mount.rb.
Compare current resource device with new resource device_fstab value.
Added specs for device_unchaged? method changes.
Signed-off-by: antima-gupta <agupta@msystechnologies.com>
Diffstat (limited to 'lib/chef/provider')
-rw-r--r-- | lib/chef/provider/mount.rb | 19 | ||||
-rw-r--r-- | lib/chef/provider/mount/mount.rb | 11 |
2 files changed, 17 insertions, 13 deletions
diff --git a/lib/chef/provider/mount.rb b/lib/chef/provider/mount.rb index 013b8a67b3..a417ef4ecc 100644 --- a/lib/chef/provider/mount.rb +++ b/lib/chef/provider/mount.rb @@ -121,9 +121,12 @@ class Chef # 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. + # See #6851 for more. + # We have to compare current resource device with device_fstab value + # because entry in /etc/fstab will be as per device_type. + # For Ex: 'LABEL=/tmp/ /mnt ext3 defaults,nofail 0 2', where 'device_type' is :label. def device_unchanged? - @current_resource.device == @new_resource.device + @current_resource.device == device_fstab end # @@ -169,6 +172,18 @@ class Chef sleep 0.1 end end + + # Retruns the new_resource device as per device_type + def device_fstab + case @new_resource.device_type + when :device + @new_resource.device + when :label + "LABEL=#{@new_resource.device}" + when :uuid + "UUID=#{@new_resource.device}" + end + end end end end diff --git a/lib/chef/provider/mount/mount.rb b/lib/chef/provider/mount/mount.rb index e3aa7e6d1c..f6a7519c06 100644 --- a/lib/chef/provider/mount/mount.rb +++ b/lib/chef/provider/mount/mount.rb @@ -212,17 +212,6 @@ class Chef private - def device_fstab - case @new_resource.device_type - when :device - @new_resource.device - when :label - "LABEL=#{@new_resource.device}" - when :uuid - "UUID=#{@new_resource.device}" - end - end - def device_real if @real_device.nil? if @new_resource.device_type == :device |