Skip to content

Commit

Permalink
Update code to allow for the special -hosts map
Browse files Browse the repository at this point in the history
  • Loading branch information
dhollinger committed Feb 21, 2018
1 parent 97e95b4 commit 26be07c
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 2 deletions.
29 changes: 29 additions & 0 deletions spec/acceptance/autofs_hosts_spec.rb
@@ -0,0 +1,29 @@
require 'spec_helper_acceptance'

describe 'autofs::mount -hosts test' do
context 'basic special -hosts test' do
it 'applies' do
pp = <<-MANIFEST
class { 'autofs': }
autofs::mount { 'auto.net':
mount => '/net',
mapfile_manage => false,
mapfile => '-hosts',
}
MANIFEST

apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
end

describe file('/etc/auto.master') do
it 'exists and has content' do
is_expected.to exist
is_expected.to be_owned_by 'root'
is_expected.to be_grouped_into 'root'
end

its(:content) { is_expected.to contain('/net -hosts') }
end
end
end
16 changes: 16 additions & 0 deletions spec/defines/mount_spec.rb
Expand Up @@ -240,6 +240,22 @@
is_expected.not_to contain_file('/data').with('ensure' => 'directory')
end
end

context 'with special -hosts map' do
let(:title) { 'auto.NET' }
let(:params) do
{
mount: '/net',
mapfile_manage: false,
mapfile: '-hosts'
}
end

it do
is_expected.to contain_concat('/etc/auto.master')
is_expected.to contain_concat__fragment('autofs::fragment preamble /net -hosts').with_target('/etc/auto.master')
end
end
end
end
end
4 changes: 2 additions & 2 deletions types/mapentry.pp
@@ -1,6 +1,6 @@
# This type matches a map type and path.
# @example program:/etc/auto.smb
# @example file:/etc/auto.file
# @example hsots:-hosts

type Autofs::Mapentry = Pattern[/^[a-z]+:\/([^\/\0]+(\/)?)+$/]

type Autofs::Mapentry = Pattern[/^[a-z]+:\/([^\/\0]+(\/)?)+$|^-hosts$/]

0 comments on commit 26be07c

Please sign in to comment.