summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChibuikem Amaechi <cramaechi@me.com>2018-01-28 06:31:58 -0600
committerChibuikem Amaechi <cramaechi@me.com>2018-01-29 23:09:32 -0600
commitfd39b4371fa22ce0569f35cb2503b7e2d176a8bb (patch)
tree0dd85efd1c67a3d392eb4c8886d7054324a0d7bd
parente9149a9a0b0b17e0c1ad38ec60d82ac07269d9df (diff)
downloadchef-fd39b4371fa22ce0569f35cb2503b7e2d176a8bb.tar.gz
Improve handling of default mount options
Signed-off-by: Chibuikem Amaechi <cramaechi@me.com>
-rw-r--r--lib/chef/provider/mount/mount.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/chef/provider/mount/mount.rb b/lib/chef/provider/mount/mount.rb
index 9913916abc..35336b4b4c 100644
--- a/lib/chef/provider/mount/mount.rb
+++ b/lib/chef/provider/mount/mount.rb
@@ -146,6 +146,15 @@ 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
+ end
+
def enable_fs
if @current_resource.enabled && mount_options_unchanged?
Chef::Log.debug("#{@new_resource} is already enabled - nothing to do")
@@ -158,7 +167,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? ? "rw" : @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(node[:os]) : @new_resource.options.join(",")} #{@new_resource.dump} #{@new_resource.pass}")
Chef::Log.debug("#{@new_resource} is enabled at #{@new_resource.mount_point}")
end
end