Skip to content

Commit a229aed

Browse files
authored
Merge pull request #1208 from bastelfreak/setting
apt::setting: Dont expect source/content when removing settings
2 parents a213640 + db4d4fb commit a229aed

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

manifests/setting.pp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@
3030
fail('apt::setting cannot have both content and source')
3131
}
3232

33-
if !$content and !$source {
34-
fail('apt::setting needs either of content or source')
33+
if $ensure != 'absent' {
34+
if !$content and !$source {
35+
fail('apt::setting needs either of content or source')
36+
}
3537
}
3638

3739
$title_array = split($title, '-')

spec/defines/setting_spec.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,16 @@
143143
it { is_expected.to contain_file('/etc/apt/apt.conf.d/100teddybear').that_notifies('Class[Apt::Update]') }
144144
end
145145

146-
describe 'with ensure=absent' do
146+
describe 'with ensure=absent and default params' do
147147
let(:params) { default_params.merge(ensure: 'absent') }
148148

149+
it {
150+
expect(subject).to contain_file('/etc/apt/apt.conf.d/50teddybear').that_notifies('Class[Apt::Update]').with(ensure: 'absent')
151+
}
152+
end
153+
describe 'with ensure=absent and without default params' do
154+
let(:params) { { ensure: 'absent' } }
155+
149156
it {
150157
expect(subject).to contain_file('/etc/apt/apt.conf.d/50teddybear').that_notifies('Class[Apt::Update]').with(ensure: 'absent')
151158
}

0 commit comments

Comments
 (0)