def disable_fs
if @current_resource.enabled
contents = []
found = false
::File.readlines("/etc/fstab").reverse_each do |line|
if !found && line =~ /^#{device_fstab_regex}\s+#{Regexp.escape(@new_resource.mount_point)}/
found = true
Chef::Log.debug("Removing #{@new_resource.mount_point} from fstab")
next
else
contents << line
end
end
::File.open("/etc/fstab", "w") do |fstab|
contents.reverse_each { |line| fstab.puts line}
end
else
Chef::Log.debug("#{@new_resource.mount_point} is not enabled")
end
end