diff --git a/manifests/source.pp b/manifests/source.pp index 5082a89f21..8ad30aa7b8 100644 --- a/manifests/source.pp +++ b/manifests/source.pp @@ -139,6 +139,8 @@ if $release =~ Pattern[/\/$/] { $_components = $_release + } elsif $repos =~ Array { + $_components = join([$_release] + $repos, ' ') } else { $_components = "${_release} ${repos}" } diff --git a/spec/defines/source_spec.rb b/spec/defines/source_spec.rb index 9c619439c0..450b850f47 100644 --- a/spec/defines/source_spec.rb +++ b/spec/defines/source_spec.rb @@ -36,6 +36,24 @@ it { expect(subject).to contain_apt__setting('list-my_source').with(ensure: 'present').without_content(%r{# my_source\ndeb-src hello.there wheezy main\n}) } + + context 'with repos' do + context 'as empty array' do + let(:params) { super().merge(repos: []) } + + it { + expect(subject).to contain_apt__setting('list-my_source').with(ensure: 'present').without_content(%r{# my_source\ndeb-src hello.there wheezy\n}) + } + end + + context 'as non-empty array' do + let(:params) { super().merge(repos: ['main', 'non-free', 'contrib']) } + + it { + 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}) + } + end + end end end