387
|
1 # @summary Import an RPM gpg key
|
272
|
2 #
|
387
|
3 # @api private
|
272
|
4 #
|
387
|
5 # @param path
|
272
|
6 # Path of the RPM GPG key to import
|
|
7 #
|
387
|
8 # @example Sample Usage
|
|
9 # epel::rpm_gpg_key{ 'EPEL-6':
|
|
10 # path => '/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6',
|
|
11 # }
|
|
12 define epel::rpm_gpg_key ($path) {
|
272
|
13 # Given the path to a key, see if it is imported, if not, import it
|
387
|
14 exec { "import-${name}":
|
272
|
15 path => '/bin:/usr/bin:/sbin:/usr/sbin',
|
|
16 command => "rpm --import ${path}",
|
387
|
17 unless => "rpm -q gpg-pubkey-$(echo $(gpg -q --batch --with-colons --throw-keyids --keyid-format short < ${path}) | grep pub | cut -d ':' -f 5 | cut --characters=9- | tr '[A-Z]' '[a-z]')",
|
272
|
18 require => File[$path],
|
|
19 logoutput => 'on_failure',
|
|
20 }
|
|
21 }
|