Skip to content

Commit bd979d4

Browse files
authored
Merge pull request #1229 from jstraw/main
Suites with a path don't get components
2 parents d172e85 + 62c0767 commit bd979d4

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

manifests/source.pp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,12 @@
310310
$_release = $release
311311
}
312312

313-
if $repos !~ Array {
313+
# The deb822 format requires that if the Suite ($release) is a path (contains a /) that
314+
# the Components field be absent. Check the original
315+
$_releasefilter = $_release.any |$item| { $item.index('/') != undef }
316+
if $_releasefilter {
317+
$_repos = undef
318+
} elsif $repos !~ Array {
314319
warning("For deb822 sources, 'repos' must be specified as an array. Converting to array.")
315320
$_repos = split($repos, /\s+/)
316321
} else {

spec/defines/source_spec.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,24 @@
480480
it { is_expected.to contain_apt__setting("sources-#{title}").with_content(%r{Trusted: yes}) }
481481
end
482482

483+
context 'path based deb822 source' do
484+
let :params do
485+
super().merge(
486+
{
487+
location: ['http://fr.debian.org/debian', 'http://de.debian.org/debian'],
488+
release: ['./'],
489+
allow_unsigned: true,
490+
},
491+
)
492+
end
493+
494+
it { is_expected.to contain_apt__setting("sources-#{title}").with_content(%r{Enabled: yes}) }
495+
it { is_expected.to contain_apt__setting("sources-#{title}").with_content(%r{URIs: http://fr.debian.org/debian http://de.debian.org/debian}) }
496+
it { is_expected.to contain_apt__setting("sources-#{title}").with_content(%r{Suites: ./}) }
497+
it { is_expected.to contain_apt__setting("sources-#{title}").without_content(%r{Components:}) }
498+
it { is_expected.to contain_apt__setting("sources-#{title}").with_content(%r{Trusted: yes}) }
499+
end
500+
483501
context '.list backwards compatibility' do
484502
let :params do
485503
super().merge(

templates/source_deb822.epp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Array[String] $types,
44
Array[String] $uris,
55
Array[String] $suites,
6-
Array[String] $components,
6+
Optional[Array[String]] $components = undef,
77
Optional[Array] $architectures = undef,
88
Optional[Enum['yes','no']] $allow_insecure = undef,
99
Optional[Enum['yes','no']] $repo_trusted = undef,
@@ -15,7 +15,9 @@ Enabled: <%= $enabled %>
1515
Types: <% $types.each |String $type| { -%> <%= $type %> <% } %>
1616
URIs: <% $uris.each | String $uri | { -%> <%= $uri %> <% } %>
1717
Suites: <% $suites.each | String $suite | { -%> <%= $suite %> <% } %>
18+
<% if $components { -%>
1819
Components: <% $components.each | String $component | { -%> <%= $component %> <% } %>
20+
<%- } -%>
1921
<% if $architectures { -%>
2022
Architectures:<% $architectures.each | String $arch | { %> <%= $arch %><% } %>
2123
<%- } -%>

0 commit comments

Comments
 (0)