2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'manifests/tools/gpgkey.pp', line 2
define psick::tools::gpgkey (
String $source = '', # lint:ignore:params_empty_string_assignment
String $rpm_gpg_dir_path = '/etc/pki/rpm-gpg',
String $checksum = '', # lint:ignore:params_empty_string_assignment
Pattern[/present|absent/] $ensure = present,
) {
if !defined(File[$rpm_gpg_dir_path]) {
file { $rpm_gpg_dir_path:
ensure => directory,
}
}
if $source != '' {
file { $title:
ensure => $ensure,
path => "${rpm_gpg_dir_path}/${title}",
source => $source,
}
}
$short_title = regsubst($title,'RPM-GPG-KEY-','')
gpg_key { $short_title:
path => "${rpm_gpg_dir_path}/${title}",
}
if $checksum != '' {
if $ensure == 'present' {
exec { "rpm --import /etc/pki/rpm-gpg/${title}":
unless => "rpm -q gpg-pubkey --qf '%{version}' | grep -i ${checksum}",
}
} else {
exec { "rpm -e gpg-pubkey-${checksum}-*":
onlyif => "rpm -qi gpg-pubkey-${checksum}-*",
}
}
}
}
|