(maint) Addressing puppet-lint doc warnings
[puppet-modules/puppetlabs-apt.git] / manifests / key.pp
index 8f9d66bcc9a1bf2b45742fec5007a9a849a98f31..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 {
@@ -36,17 +41,15 @@ define apt::key (
 
         case $facts['os']['name'] {
           'Debian': {
-            if versioncmp($facts['os']['release']['full'], '9.0') >= 0 {
-              Apt::Key<| title == $title |> {
-                require => Package['dirmngr']
-              }
+            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 {
-              Apt::Key<| title == $title |> {
-                require => Package['dirmngr']
-              }
+              ensure_packages(['dirmngr'])
+              Apt::Key<| title == $title |>
             }
           }
           default: { }