Skip to content

Commit 5b78cf7

Browse files
committed
source: allow passing all apt::keyring attributes
This uses the same logic as apt::keyring itself, and what I think would be the least surprising logic: 1. Passing both `dir` and `filename`: you have provided the full path, so that is used in the signed-by setting. 2. Passing just the `filename` means you want to use the default dir, /etc/apt/keyrings. 3. Passing just the `dir` means you want to use the given directory, and the `name` attribute as the filename. 4. Passing only `name` means use `name` with the default dir.
1 parent 094bfdb commit 5b78cf7

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

manifests/source.pp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,14 +186,20 @@
186186
ensure => $_key_ensure,
187187
content => $_key['content'],
188188
source => $_key['source'],
189+
dir => $_key['dir'],
189190
filename => $_key['filename'],
191+
mode => $_key['mode'],
190192
before => $_before,
191193
}
192-
# TODO replace this block with a reference to the apt::keyring's final filename/full_path
193-
if $_key['filename'] {
194-
$_list_keyring = $_key['filename']
194+
195+
$_list_keyring = if $_key['dir'] and $_key['filename'] {
196+
"${_key['dir']}${_key['filename']}"
197+
} elsif $_key['filename'] {
198+
"/etc/apt/keyrings/${_key['filename']}"
199+
} elsif $_key['dir'] {
200+
"${_key['dir']}${_key['name']}"
195201
} else {
196-
$_list_keyring = "/etc/apt/keyrings/${_key['name']}"
202+
"/etc/apt/keyrings/${_key['name']}"
197203
}
198204
}
199205
} else {

0 commit comments

Comments
 (0)