Merge pull request #442 from mhaskel/add_base_name
Add base_name parameter to apt::setting
This commit is contained in:
commit
1c0c6f106a
2 changed files with 15 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
|||
define apt::setting (
|
||||
$setting_type,
|
||||
$base_name = $title,
|
||||
$priority = 50,
|
||||
$ensure = file,
|
||||
$source = undef,
|
||||
|
@ -19,6 +20,7 @@ define apt::setting (
|
|||
|
||||
validate_re($setting_type, ['conf', 'pref', 'list'])
|
||||
validate_re($ensure, ['file', 'present', 'absent'])
|
||||
validate_string($base_name)
|
||||
|
||||
unless is_integer($priority) {
|
||||
# need this to allow zero-padded priority.
|
||||
|
@ -42,7 +44,7 @@ define apt::setting (
|
|||
$_path = $::apt::config_files[$setting_type]['path']
|
||||
$_ext = $::apt::config_files[$setting_type]['ext']
|
||||
|
||||
file { "${_path}/${_priority}${title}${_ext}":
|
||||
file { "${_path}/${_priority}${base_name}${_ext}":
|
||||
ensure => $ensure,
|
||||
owner => $_file['owner'],
|
||||
group => $_file['group'],
|
||||
|
|
|
@ -95,6 +95,18 @@ describe 'apt::setting' do
|
|||
it { is_expected.to contain_file('/etc/apt/apt.conf.d/100teddybear') }
|
||||
end
|
||||
|
||||
describe 'with base_name=puppy' do
|
||||
let(:params) { default_params.merge({ :base_name => 'puppy' }) }
|
||||
it { should contain_file('/etc/apt/apt.conf.d/50puppy') }
|
||||
end
|
||||
|
||||
describe 'with base_name=true' do
|
||||
let(:params) { default_params.merge({ :base_name => true }) }
|
||||
it do
|
||||
expect { should compile }.to raise_error(Puppet::Error, /not a string/)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'with ensure=absent' do
|
||||
let(:params) { default_params.merge({ :ensure => 'absent' }) }
|
||||
it { is_expected.to contain_file('/etc/apt/apt.conf.d/50teddybear').with({
|
||||
|
|
Loading…
Reference in a new issue