Skip to content

Commit

Permalink
working automaster_entry with deprication warning
Browse files Browse the repository at this point in the history
  • Loading branch information
damacus committed Oct 22, 2015
1 parent 94986bd commit 0f44efb
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 76 deletions.
74 changes: 0 additions & 74 deletions libraries/autofs.rb

This file was deleted.

2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
description 'Configures the autofs service'
version '1.0.4'

depends 'resource', '= 0.2.2'
depends 'compat_resource', '~> 12.5.10'
depends 'chef-sugar', '= 3.1.0'
depends 'line', '= 0.6.1'
1 change: 1 addition & 0 deletions resources/autofs.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

18 changes: 18 additions & 0 deletions resources/automaster_entry.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
property :mount_point, String, name_property: true
property :map, String
property :options, String

action :create 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
32 changes: 32 additions & 0 deletions resources/map_entry.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
property :key, String, name_property: true
property :location, Path
property :options, default: nil
property :map, Path
property :fstype, String
# property :mount_point, Path, default: '/' + map.match(/(?:\.)(.*)/).captures[0]

action :create do
file map
automaster_entry mount_point do
map
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
6 changes: 6 additions & 0 deletions resources/nfs.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
property :server, String
property :export, Path
# property :location, default: "#{server}:#{export}"
property :map, default: '/etc/auto.nfs'
property :mount_point, default: '/-'
property :fstype, default: 'nfs4'
3 changes: 2 additions & 1 deletion test/fixtures/cookbooks/auto_master/recipes/default.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
automaster_entry '/misc', '/etc/auto.misc' do
automaster_entry '/misc' do
map '/etc/auto.misc'
end

0 comments on commit 0f44efb

Please sign in to comment.