Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update code to allow for the special -hosts map #94

Merged
merged 1 commit into from Feb 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 hosts:-hosts

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

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