Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 9c4f71d

Browse files
authoredAug 3, 2022
Merge pull request #1042 from david22swan/GH-1038/main/check_valid_until
(GH-1038) add support for `check-valid-until` configuration
2 parents 2109a42 + 3d3620c commit 9c4f71d

File tree

3 files changed

+48
-5
lines changed

3 files changed

+48
-5
lines changed
 

‎REFERENCE.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -937,6 +937,7 @@ The following parameters are available in the `apt::source` defined type:
937937
* [`allow_unsigned`](#allow_unsigned)
938938
* [`notify_update`](#notify_update)
939939
* [`allow_insecure`](#allow_insecure)
940+
* [`check_valid_until`](#check_valid_until)
940941

941942
##### <a name="location"></a>`location`
942943

@@ -1049,10 +1050,18 @@ Default value: ``true``
10491050

10501051
Data type: `Boolean`
10511052

1052-
1053+
Specifies whether to allow downloads from insecure repositories.
10531054

10541055
Default value: ``false``
10551056

1057+
##### <a name="check_valid_until"></a>`check_valid_until`
1058+
1059+
Data type: `Boolean`
1060+
1061+
Specifies whether to check if the package release date is valid. Defaults to `True`.
1062+
1063+
Default value: ``true``
1064+
10561065
## Resource types
10571066

10581067
## Data types

‎manifests/source.pp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,15 @@
5555
# @param allow_unsigned
5656
# Specifies whether to authenticate packages from this release, even if the Release file is not signed or the signature can't be checked.
5757
#
58+
# @param allow_insecure
59+
# Specifies whether to allow downloads from insecure repositories.
60+
#
5861
# @param notify_update
5962
# Specifies whether to trigger an `apt-get update` run.
6063
#
64+
# @param check_valid_until
65+
# Specifies whether to check if the package release date is valid. Defaults to `True`.
66+
#
6167
define apt::source (
6268
Optional[String] $location = undef,
6369
String $comment = $name,
@@ -72,6 +78,7 @@
7278
Boolean $allow_unsigned = false,
7379
Boolean $allow_insecure = false,
7480
Boolean $notify_update = true,
81+
Boolean $check_valid_until = true,
7582
) {
7683
include ::apt
7784

@@ -136,10 +143,11 @@
136143
'comment' => $comment,
137144
'includes' => $includes,
138145
'options' => delete_undef_values( {
139-
'arch' => $architecture,
140-
'trusted' => $allow_unsigned ? { true => 'yes', false => undef },
141-
'allow-insecure' => $allow_insecure ? { true => 'yes', false => undef },
142-
'signed-by' => $keyring,
146+
'arch' => $architecture,
147+
'trusted' => $allow_unsigned ? { true => 'yes', false => undef },
148+
'allow-insecure' => $allow_insecure ? { true => 'yes', false => undef },
149+
'signed-by' => $keyring,
150+
'check-valid-until' => $check_valid_until? { true => undef, false => 'false' },
143151
},
144152
),
145153
'location' => $_location,

‎spec/defines/source_spec.rb

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,32 @@
171171
}
172172
end
173173

174+
context 'with check_valid_until false' do
175+
let :params do
176+
{
177+
location: 'hello.there',
178+
check_valid_until: false,
179+
}
180+
end
181+
182+
it {
183+
is_expected.to contain_apt__setting('list-my_source').with(ensure: 'present').with_content(%r{# my_source\ndeb \[check-valid-until=false\] hello.there stretch main\n})
184+
}
185+
end
186+
187+
context 'with check_valid_until true' do
188+
let :params do
189+
{
190+
location: 'hello.there',
191+
check_valid_until: true,
192+
}
193+
end
194+
195+
it {
196+
is_expected.to contain_apt__setting('list-my_source').with(ensure: 'present').with_content(%r{# my_source\ndeb hello.there stretch main\n})
197+
}
198+
end
199+
174200
context 'with keyring set' do
175201
let :params do
176202
{

0 commit comments

Comments
 (0)
Please sign in to comment.