Skip to content

Commit 00c401c

Browse files
committed
Handle repos passed as an array for list format
In 9876c31 the parameter repos was changed to no longer allow an empty string. It does allow an array, but that isn't specifically handled for the list format. Fixes: 9876c31 ("Add support for deb822 APT sources (puppetlabs#1167)")
1 parent 39adff0 commit 00c401c

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

manifests/source.pp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@
139139

140140
if $release =~ Pattern[/\/$/] {
141141
$_components = $_release
142+
} elsif $repos =~ Array {
143+
$_components = join([$_release] + $repos, ' ')
142144
} else {
143145
$_components = "${_release} ${repos}"
144146
}

spec/defines/source_spec.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,24 @@
3636
it {
3737
expect(subject).to contain_apt__setting('list-my_source').with(ensure: 'present').without_content(%r{# my_source\ndeb-src hello.there wheezy main\n})
3838
}
39+
40+
context 'with repos' do
41+
context 'as empty array' do
42+
let(:params) { super().merge(repos: []) }
43+
44+
it {
45+
expect(subject).to contain_apt__setting('list-my_source').with(ensure: 'present').without_content(%r{# my_source\ndeb-src hello.there wheezy\n})
46+
}
47+
end
48+
49+
context 'as non-empty array' do
50+
let(:params) { super().merge(repos: ['main', 'non-free', 'contrib']) }
51+
52+
it {
53+
expect(subject).to contain_apt__setting('list-my_source').with(ensure: 'present').without_content(%r{# my_source\ndeb-src hello.there wheezy main non-free contrib\n})
54+
}
55+
end
56+
end
3957
end
4058
end
4159

0 commit comments

Comments
 (0)