changeset 423:a200bf678bec

Resolve deprecation warnings in stdlib type3x Based on https://github.com/goodrobots/maverick/commit/3a14afe0c449b9a1313762458d35fb0dad9ace56
author IBBoard <dev@ibboard.co.uk>
date Sun, 09 Oct 2022 10:34:07 +0100
parents 8421eb25c329
children 4a2ee7e3b110
files modules/ssh/manifests/init.pp
diffstat 1 files changed, 45 insertions(+), 45 deletions(-) [+]
line wrap: on
line diff
--- a/modules/ssh/manifests/init.pp	Sat Oct 08 20:58:14 2022 +0100
+++ b/modules/ssh/manifests/init.pp	Sun Oct 09 10:34:07 2022 +0100
@@ -593,11 +593,11 @@
   if $ssh_config_include == 'USE_DEFAULTS' {
     $ssh_config_include_real = $default_ssh_config_include
   } else {
-    case type3x($ssh_config_include) {
-      'array': {
+    case $ssh_config_include {
+      Array: {
         validate_legacy("Array[String]", "validate_array", $ssh_config_include)
       }
-      'string': {
+      String: {
         validate_legacy("String", "validate_string", $ssh_config_include)
       }
       default: {
@@ -610,12 +610,12 @@
   if $ssh_sendenv == 'USE_DEFAULTS' {
     $ssh_sendenv_real = $default_ssh_sendenv
   } else {
-    case type3x($ssh_sendenv) {
-      'string': {
+    case $ssh_sendenv {
+      String: {
         validate_legacy("String", "validate_re", $ssh_sendenv, "^(true|false)$", "ssh::ssh_sendenv may be either 'true' or 'false' and is set to <${ssh_sendenv}>.")
-        $ssh_sendenv_real = str2bool($ssh_sendenv)
+        $ssh_sendenv_real = Boolean($ssh_sendenv)
       }
-      'boolean': {
+      Boolean: {
         $ssh_sendenv_real = $ssh_sendenv
       }
       default: {
@@ -627,12 +627,12 @@
   if $sshd_acceptenv == 'USE_DEFAULTS' {
     $sshd_acceptenv_real = $default_sshd_acceptenv
   } else {
-    case type3x($sshd_acceptenv) {
-      'string': {
+    case $sshd_acceptenv {
+      String: {
         validate_legacy("String", "validate_re", $sshd_acceptenv, '^(true|false)$', "ssh::sshd_acceptenv may be either 'true' or 'false' and is set to <${sshd_acceptenv}>.")
-        $sshd_acceptenv_real = str2bool($sshd_acceptenv)
+        $sshd_acceptenv_real = Boolean($sshd_acceptenv)
       }
-      'boolean': {
+      Boolean: {
         $sshd_acceptenv_real = $sshd_acceptenv
       }
       default: {
@@ -656,12 +656,12 @@
   if $service_hasstatus == 'USE_DEFAULTS' {
     $service_hasstatus_real = $default_service_hasstatus
   } else {
-    case type3x($service_hasstatus) {
-      'string': {
+    case $service_hasstatus {
+      String: {
         validate_legacy('String', 'validate_re', $service_hasstatus, '^(true|false)$', "ssh::service_hasstatus must be 'true' or 'false' and is set to <${service_hasstatus}>.")
-        $service_hasstatus_real = str2bool($service_hasstatus)
+        $service_hasstatus_real = Boolean($service_hasstatus)
       }
-      'boolean': {
+      Boolean: {
         $service_hasstatus_real = $service_hasstatus
       }
       default: {
@@ -679,11 +679,11 @@
   if $sshd_config_include == 'USE_DEFAULTS' {
     $sshd_config_include_real = $default_sshd_config_include
   } else {
-    case type3x($sshd_config_include) {
-      'array': {
+    case $sshd_config_include {
+      Array: {
         validate_legacy("Array[String]", "validate_array", $sshd_config_include)
       }
-      'string': {
+      String: {
         validate_legacy("String", "validate_string", $sshd_config_include)
       }
       default: {
@@ -767,15 +767,15 @@
   if $sshd_config_compression != undef {
     validate_legacy('String', 'validate_re', $sshd_config_compression, '^(yes|no|delayed)$', "ssh::sshd_config_compression may be either 'yes', 'no' or 'delayed' and is set to <${sshd_config_compression}>.")
   }
-  case type3x($sshd_config_port) {
-    'string': {
+  case $sshd_config_port {
+    String: {
       validate_legacy('String', 'validate_re', $sshd_config_port, '^\d+$', "ssh::sshd_config_port must be a valid number and is set to <${sshd_config_port}>.")
-      $sshd_config_port_array = [ str2num($sshd_config_port) ]
+      $sshd_config_port_array = [ Integer($sshd_config_port) ]
     }
-    'array': {
+    Array: {
       $sshd_config_port_array = $sshd_config_port
     }
-    'integer': {
+    Integer: {
       $sshd_config_port_array = [ $sshd_config_port ]
     }
     default: {
@@ -902,12 +902,12 @@
 
   validate_legacy('String', 'validate_re', $sshd_ignorerhosts, '^(yes|no)$', "ssh::sshd_ignorerhosts may be either 'yes' or 'no' and is set to <${sshd_ignorerhosts}>.")
 
-  case type3x($hiera_merge) {
-    'string': {
+  case $hiera_merge {
+    String: {
       validate_legacy('String', 'validate_re', $hiera_merge, '^(true|false)$', "ssh::hiera_merge may be either 'true' or 'false' and is set to <${hiera_merge}>.")
-      $hiera_merge_real = str2bool($hiera_merge)
+      $hiera_merge_real = Boolean($hiera_merge)
     }
-    'boolean': {
+    Boolean: {
       $hiera_merge_real = $hiera_merge
     }
     default: {
@@ -915,12 +915,12 @@
     }
   }
 
-  case type3x($ssh_key_import) {
-    'string': {
+  case $ssh_key_import {
+    String: {
       validate_legacy('String', 'validate_re', $ssh_key_import, '^(true|false)$', "ssh::ssh_key_import may be either 'true' or 'false' and is set to <${ssh_key_import}>.")
-      $ssh_key_import_real = str2bool($ssh_key_import)
+      $ssh_key_import_real = Boolean($ssh_key_import)
     }
-    'boolean': {
+    Boolean: {
       $ssh_key_import_real = $ssh_key_import
     }
     default: {
@@ -929,11 +929,11 @@
   }
   validate_legacy(Stdlib::Compat::Bool, 'validate_bool', $ssh_key_import_real)
 
-  case type3x($ssh_config_sendenv_xmodifiers) {
-    'string': {
-      $ssh_config_sendenv_xmodifiers_real = str2bool($ssh_config_sendenv_xmodifiers)
+  case $ssh_config_sendenv_xmodifiers {
+    String: {
+      $ssh_config_sendenv_xmodifiers_real = Boolean($ssh_config_sendenv_xmodifiers)
     }
-    'boolean': {
+    Boolean: {
       $ssh_config_sendenv_xmodifiers_real = $ssh_config_sendenv_xmodifiers
     }
     default: {
@@ -985,36 +985,36 @@
   validate_legacy('String', 'validate_re', $ssh_config_global_known_hosts_mode, '^[0-7]{4}$',
     "ssh::ssh_config_global_known_hosts_mode must be a valid 4 digit mode in octal notation. Detected value is <${ssh_config_global_known_hosts_mode}>.")
 
-  if type3x($purge_keys) == 'string' {
-    $purge_keys_real = str2bool($purge_keys)
+  if $purge_keys =~ String {
+    $purge_keys_real = Boolean($purge_keys)
   } else {
     $purge_keys_real = $purge_keys
   }
   validate_legacy(Stdlib::Compat::Bool, 'validate_bool', $purge_keys_real)
 
-  if type3x($manage_service) == 'string' {
-    $manage_service_real = str2bool($manage_service)
+  if $manage_service =~ String {
+    $manage_service_real = Boolean($manage_service)
   } else {
     $manage_service_real = $manage_service
   }
   validate_legacy(Stdlib::Compat::Bool, 'validate_bool', $manage_service_real)
 
-  if type3x($service_enable) == 'string' {
-    $service_enable_real = str2bool($service_enable)
+  if $service_enable =~ String {
+    $service_enable_real = Boolean($service_enable)
   } else {
     $service_enable_real = $service_enable
   }
   validate_legacy(Stdlib::Compat::Bool, 'validate_bool', $service_enable_real)
 
-  if type3x($service_hasrestart) == 'string' {
-    $service_hasrestart_real = str2bool($service_hasrestart)
+  if $service_hasrestart =~ String {
+    $service_hasrestart_real = Boolean($service_hasrestart)
   } else {
     $service_hasrestart_real = $service_hasrestart
   }
   validate_legacy(Stdlib::Compat::Bool, 'validate_bool', $service_hasrestart_real)
 
-  if type3x($manage_root_ssh_config) == 'string' {
-    $manage_root_ssh_config_real = str2bool($manage_root_ssh_config)
+  if $manage_root_ssh_config =~ String {
+    $manage_root_ssh_config_real = Boolean($manage_root_ssh_config)
   } else {
     $manage_root_ssh_config_real = $manage_root_ssh_config
   }