Skip to content

Commit

Permalink
Merge pull request #1215 from ekohl/handle-repos-as-array
Browse files Browse the repository at this point in the history
Handle repos passed as an array for list format
  • Loading branch information
bastelfreak authored Jan 6, 2025
2 parents 39adff0 + 00c401c commit 5e34dcb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions manifests/source.pp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@

if $release =~ Pattern[/\/$/] {
$_components = $_release
} elsif $repos =~ Array {
$_components = join([$_release] + $repos, ' ')
} else {
$_components = "${_release} ${repos}"
}
Expand Down
18 changes: 18 additions & 0 deletions spec/defines/source_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 5e34dcb

Please sign in to comment.