Skip to content

Commit

Permalink
Handle repos passed as an array for list format
Browse files Browse the repository at this point in the history
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 (#1167)")
  • Loading branch information
ekohl committed Jan 6, 2025
1 parent 39adff0 commit 00c401c
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 00c401c

Please sign in to comment.