diff modules/epel/manifests/rpm_gpg_key.pp @ 272:c42fb28cff86

Update to a newer Python module This also pulls in an EPEL module (which we don't use) and a newer stdlib version.
author IBBoard <dev@ibboard.co.uk>
date Fri, 03 Jan 2020 19:56:04 +0000
parents
children 66c075c5f54a
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/epel/manifests/rpm_gpg_key.pp	Fri Jan 03 19:56:04 2020 +0000
@@ -0,0 +1,28 @@
+# 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',
+  }
+}