summaryrefslogtreecommitdiff
path: root/lib/chef/provider/mount/mount.rb
diff options
context:
space:
mode:
authorChibuikem Amaechi <cramaechi@me.com>2018-01-29 23:09:24 -0600
committerChibuikem Amaechi <cramaechi@me.com>2018-01-29 23:16:35 -0600
commit4f394f02120882f41909e742d763ab382f88682e (patch)
tree16a98fa5b381fa8f5fed8eb6100f395791d080eb /lib/chef/provider/mount/mount.rb
parent0f45f8e107980a2cd49d4786fe5abd77b8085713 (diff)
downloadchef-4f394f02120882f41909e742d763ab382f88682e.tar.gz
Update logic in mount/mount.rb and mount/mount_spec.rb
Signed-off-by: Chibuikem Amaechi <cramaechi@me.com>
Diffstat (limited to 'lib/chef/provider/mount/mount.rb')
-rw-r--r--lib/chef/provider/mount/mount.rb12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/chef/provider/mount/mount.rb b/lib/chef/provider/mount/mount.rb
index 35336b4b4c..0be45e80da 100644
--- a/lib/chef/provider/mount/mount.rb
+++ b/lib/chef/provider/mount/mount.rb
@@ -146,13 +146,9 @@ class Chef
end
end
- # Return appropriate default mount options according to the input os.
- def default_mount_options(os)
- if os == "freebsd"
- "rw"
- else
- "defaults"
- end
+ # Return appropriate default mount options according to the given os.
+ def default_mount_options
+ node[:os] == "linux" ? "defaults" : "rw"
end
def enable_fs
@@ -167,7 +163,7 @@ class Chef
disable_fs
end
::File.open("/etc/fstab", "a") do |fstab|
- fstab.puts("#{device_fstab} #{@new_resource.mount_point} #{@new_resource.fstype} #{@new_resource.options.nil? ? default_mount_options(node[:os]) : @new_resource.options.join(",")} #{@new_resource.dump} #{@new_resource.pass}")
+ fstab.puts("#{device_fstab} #{@new_resource.mount_point} #{@new_resource.fstype} #{@new_resource.options.nil? ? default_mount_options : @new_resource.options.join(",")} #{@new_resource.dump} #{@new_resource.pass}")
Chef::Log.debug("#{@new_resource} is enabled at #{@new_resource.mount_point}")
end
end