<commit_before>Chef.resource :automaster_entry do
  property :mount_point, String, identity: true
  property :map, Path, identity: true
  property :options, String

  recipe do
    package 'autofs'
    service 'autofs' do
      action [:enable, :start]
    end
    file '/etc/auto.master'

    replace_or_add mount_point do
      path '/etc/auto.master'
      pattern "#{mount_point} #{map}.*"
      line "#{mount_point} #{map} #{options}"
      notifies :reload, 'service[autofs]', :immediately
    end
  end
end

Chef.resource :map_entry do
  property :key, String, identity: true
  property :location, Path
  property :options, default: nil
  property :map, Path
  property :fstype, String
  property :mount_point, Path do
    default { '/' + map.match(/(?:\.)(.*)/).captures[0] }
  end
  recipe do
    file map
    automaster_entry mount_point, map do
    end
    service 'autofs'
    if options.nil?
      opts = fstype
    else
      opts = [fstype, options].join(',')
    end
    replace_or_add key do
      path map
      pattern "#{key}.*#{location}.*"
      line "#{key} -fstype=#{opts} #{location}"
      notifies :reload, 'service[autofs]', :immediately
    end

    case fstype
    when 'nfs4'
      include_recipe 'chef-sugar'
      package 'nfs-utils' if rhel?
      package 'nfs-common' if debian?
    end
  end
end

Chef.resource :nfs, :map_entry do<commit_msg>Fixes #9 uses only mountpoint as the unique key<commit_after>Chef.resource :automaster_entry do
  property :mount_point, String, identity: true
  property :map, Path, identity: true
  property :options, String

  recipe do
    package 'autofs'
    service 'autofs' do
      action [:enable, :start]
    end
    file '/etc/auto.master'

    replace_or_add mount_point do
      path '/etc/auto.master'
      pattern "#{mount_point} #{map}.*"
      line "#{mount_point} #{map} #{options}"
      notifies :reload, 'service[autofs]', :immediately
    end
  end
end

Chef.resource :map_entry do
  property :key, String, identity: true
  property :location, Path
  property :options, default: nil
  property :map, Path
  property :fstype, String
  property :mount_point, Path do
    default { '/' + map.match(/(?:\.)(.*)/).captures[0] }
  end
  recipe do
    file map
    automaster_entry mount_point, map do
    end
    service 'autofs'
    if options.nil?
      opts = fstype
    else
      opts = [fstype, options].join(',')
    end
    replace_or_add key do
      path map
      pattern "#{key}.*"
      line "#{key} -fstype=#{opts} #{location}"
      notifies :reload, 'service[autofs]', :immediately
    end

    case fstype
    when 'nfs4'
      include_recipe 'chef-sugar'
      package 'nfs-utils' if rhel?
      package 'nfs-common' if debian?
    end
  end
end

Chef.resource :nfs, :map_entry do
{'fraction_non_alphanumeric': 0.12099387828592006, 'fraction_numerical': 0.0018005041411595247, 'mean_word_length': 2.847645429362881, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2928372', 'n_tokens_mistral': 942, 'n_tokens_neox': 936, 'n_words': 273}