diff modules/apt/manifests/key.pp @ 478:adf6fe9bbc17

Update Puppet modules to latest versions
author IBBoard <dev@ibboard.co.uk>
date Thu, 29 Aug 2024 18:47:29 +0100
parents 3fce34f642f1
children
line wrap: on
line diff
--- a/modules/apt/manifests/key.pp	Tue Aug 27 13:35:17 2024 +0100
+++ b/modules/apt/manifests/key.pp	Thu Aug 29 18:47:29 2024 +0100
@@ -40,14 +40,13 @@
   Enum['present', 'absent', 'refreshed'] $ensure                                                                        = present,
   Optional[String] $content                                                                                             = undef,
   Optional[Pattern[/\Ahttps?:\/\//, /\Aftp:\/\//, /\A\/\w+/]] $source                                                   = undef,
-  Pattern[/\A((hkp|hkps|http|https):\/\/)?([a-z\d])([a-z\d-]{0,61}\.)+[a-z\d]+(:\d{2,5})?(\/[a-zA-Z\d\-_.]+)*\/?$/] $server = $::apt::keyserver,
+  Pattern[/\A((hkp|hkps|http|https):\/\/)?([a-z\d])([a-z\d-]{0,61}\.)+[a-z\d]+(:\d{2,5})?(\/[a-zA-Z\d\-_.]+)*\/?$/] $server = $apt::keyserver,
   Boolean $weak_ssl                                                                                                     = false,
-  Optional[String] $options                                                                                             = $::apt::key_options,
-  ) {
-
+  Optional[String] $options                                                                                             = $apt::key_options,
+) {
   case $ensure {
     /^(refreshed|present)$/: {
-      if defined(Anchor["apt_key ${id} absent"]){
+      if defined(Anchor["apt_key ${id} absent"]) {
         fail("key with id ${id} already ensured as absent")
       }
 
@@ -65,28 +64,26 @@
 
         case $facts['os']['name'] {
           'Debian': {
-            if versioncmp($facts['os']['release']['major'], '9') >= 0 {
-              ensure_packages(['gnupg'])
-              Apt::Key<| title == $title |>
-            }
+            stdlib::ensure_packages(['gnupg'])
+            Apt::Key<| title == $title |>
           }
           'Ubuntu': {
-            if versioncmp($facts['os']['release']['full'], '17.04') >= 0 {
-              ensure_packages(['gnupg'])
-              Apt::Key<| title == $title |>
-            }
+            stdlib::ensure_packages(['gnupg'])
+            Apt::Key<| title == $title |>
           }
-          default: { }
+          default: {
+            # Nothing in here
+          }
         }
       }
     }
 
-    absent: {
-      if defined(Anchor["apt_key ${id} present"]){
+    /^absent$/: {
+      if defined(Anchor["apt_key ${id} present"]) {
         fail("key with id ${id} already ensured as present")
       }
 
-      if !defined(Anchor["apt_key ${id} absent"]){
+      if !defined(Anchor["apt_key ${id} absent"]) {
         apt_key { $title:
           ensure   => $ensure,
           id       => $id,