Merge branch 'master' into remove_ppa_source
[puppet-modules/puppetlabs-apt.git] / manifests / key.pp
index a8c9f54950a368463c8bcd95f8d4ca6880519763..1933b3f9110b996e666208132e06188d1dc8c5a6 100644 (file)
@@ -8,14 +8,19 @@ define apt::key (
     Optional[String] $options            = undef,
     ) {
 
-  validate_re($id, ['\A(0x)?[0-9a-fA-F]{8}\Z', '\A(0x)?[0-9a-fA-F]{16}\Z', '\A(0x)?[0-9a-fA-F]{40}\Z'])
+  assert_type(
+    Pattern[
+      /\A(0x)?[0-9a-fA-F]{8}\Z/,
+      /\A(0x)?[0-9a-fA-F]{16}\Z/,
+      /\A(0x)?[0-9a-fA-F]{40}\Z/,
+    ], $id)
 
   if $source {
-    validate_re($source, ['\Ahttps?:\/\/', '\Aftp:\/\/', '\A\/\w+'])
+    assert_type(Pattern[/\Ahttps?:\/\//, /\Aftp:\/\//, /\A\/\w+/], $source)
   }
 
   if $server {
-    validate_re($server,['\A((hkp|http|https):\/\/)?([a-z\d])([a-z\d-]{0,61}\.)+[a-z\d]+(:\d{2,5})?$'])
+    assert_type(Pattern[/\A((hkp|http|https):\/\/)?([a-z\d])([a-z\d-]{0,61}\.)+[a-z\d]+(:\d{2,5})?$/], $server)
   }
 
   case $ensure {
@@ -38,11 +43,13 @@ define apt::key (
           'Debian': {
             if versioncmp($facts['os']['release']['major'], '9') >= 0 {
               ensure_packages(['dirmngr'])
+              Apt::Key<| title == $title |>
             }
           }
           'Ubuntu': {
             if versioncmp($facts['os']['release']['full'], '17.04') >= 0 {
               ensure_packages(['dirmngr'])
+              Apt::Key<| title == $title |>
             }
           }
           default: { }