view modules/epel/manifests/rpm_gpg_key.pp @ 320:99e3ca448d55

Fix Remi PHP on CentOS 8 It uses the new "modules" approach, so we need to use a new package provider They also use different signing keys
author IBBoard <dev@ibboard.co.uk>
date Sun, 01 Mar 2020 10:58:00 +0000
parents c42fb28cff86
children 66c075c5f54a
line wrap: on
line source

# Define epel::rpm_gpg_key
#
# Actions:
#   Import a RPM gpg key
#
# Parameters:
#
# [*path*]
#   Path of the RPM GPG key to import
#
# Reqiures:
#   You should probably be on an Enterprise Linux variant. (Centos, RHEL, Scientific, Oracle, Ascendos, et al)
#
# Sample Usage:
#  epel::rpm_gpg_key{ "EPEL-6":
#    path => "/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6"
#  }
#
define epel::rpm_gpg_key($path) {
  # Given the path to a key, see if it is imported, if not, import it
  exec {  "import-${name}":
    path      => '/bin:/usr/bin:/sbin:/usr/sbin',
    command   => "rpm --import ${path}",
    unless    => "rpm -q gpg-pubkey-$(echo $(gpg --throw-keyids --keyid-format short < ${path}) | cut --characters=11-18 | tr '[A-Z]' '[a-z]')",
    require   => File[$path],
    logoutput => 'on_failure',
  }
}