Skip to content

Commit 5e34dcb

Browse files
authored
Merge pull request #1215 from ekohl/handle-repos-as-array
Handle repos passed as an array for list format
2 parents 39adff0 + 00c401c commit 5e34dcb

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

manifests/source.pp

+2
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

+18
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)