From 7eaf5d107813e464332aeeedb69a16bfed2ac049 Mon Sep 17 00:00:00 2001 From: r-savcenko Date: Mon, 23 Oct 2023 13:50:37 +0300 Subject: [PATCH 1/4] Replace outdated validate_* functions --- manifests/init.pp | 58 +++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 46cdf60..920550f 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -33,17 +33,15 @@ $nsswitch_project = 'USE_DEFAULTS', ) { - validate_absolute_path($config_file) - validate_re($ensure_ldap, '^(present|absent)$', - 'Valid values for ensure_ldap are \'absent\' and \'present\'.') - validate_re($ensure_vas, '^(present|absent)$', - 'Valid values for ensure_vas are \'absent\' and \'present\'.') - validate_string($vas_nss_module_passwd) - validate_string($vas_nss_module_group) - validate_string($vas_nss_module_automount) - validate_string($vas_nss_module_netgroup) - validate_string($vas_nss_module_aliases) - validate_string($vas_nss_module_services) + validate_legacy(String, 'validate_absolute_path', $config_file) + validate_legacy(String, 'validate_re', $ensure_ldap, '^(present|absent)$', 'Valid values for ensure_ldap are \'absent\' and \'present\'.') + validate_legacy(String, 'validate_re', $ensure_vas, '^(present|absent)$','Valid values for ensure_vas are \'absent\' and \'present\'.') + validate_legacy(String, 'validate_string', $vas_nss_module_passwd) + validate_legacy(String, 'validate_string', $vas_nss_module_group) + validate_legacy(String, 'validate_string', $vas_nss_module_automount) + validate_legacy(String, 'validate_string', $vas_nss_module_netgroup) + validate_legacy(String, 'validate_string', $vas_nss_module_aliases) + validate_legacy(String, 'validate_string', $vas_nss_module_services) case $::osfamily { 'Debian','Suse': { @@ -137,98 +135,98 @@ } else { $passwd_real = $passwd } - validate_string($passwd_real) + validate_legacy(String, 'validate_string', $passwd_real) if $protocols == 'USE_DEFAULTS' { $protocols_real = $default_protocols } else { $protocols_real = $protocols } - validate_string($protocols_real) + validate_legacy(String, 'validate_string', $protocols_real) if $ethers == 'USE_DEFAULTS' { $ethers_real = $default_ethers } else { $ethers_real = $ethers } - validate_string($ethers_real) + validate_legacy(String, 'validate_string', $ethers_real) if $rpc == 'USE_DEFAULTS' { $rpc_real = $default_rpc } else { $rpc_real = $rpc } - validate_string($rpc_real) + validate_legacy(String, 'validate_string', $rpc_real) if $shadow == 'USE_DEFAULTS' { $shadow_real = $default_shadow } else { $shadow_real = $shadow } - validate_string($shadow_real) + validate_legacy(String, 'validate_string', $shadow_real) if $sudoers == 'USE_DEFAULTS' { $sudoers_real = $default_sudoers } else { $sudoers_real = $sudoers } - validate_string($sudoers_real) + validate_legacy(String, 'validate_string', $sudoers_real) if $group == 'USE_DEFAULTS' { $group_real = $default_group } else { $group_real = $group } - validate_string($group_real) + validate_legacy(String, 'validate_string', $group_real) if $hosts == 'USE_DEFAULTS' { $hosts_real = $default_hosts } else { $hosts_real = $hosts } - validate_string($hosts_real) + validate_legacy(String, 'validate_string', $hosts_real) if $automount == 'USE_DEFAULTS' { $automount_real = $default_automount } else { $automount_real = $automount } - validate_string($automount_real) + validate_legacy(String, 'validate_string', $automount_real) if $services == 'USE_DEFAULTS' { $services_real = $default_services } else { $services_real = $services } - validate_string($services_real) + validate_legacy(String, 'validate_string', $services_real) if $bootparams == 'USE_DEFAULTS' { $bootparams_real = $default_bootparams } else { $bootparams_real = $bootparams } - validate_string($bootparams_real) + validate_legacy(String, 'validate_string', $bootparams_real) if $aliases == 'USE_DEFAULTS' { $aliases_real = $default_aliases } else { $aliases_real = $aliases } - validate_string($aliases_real) + validate_legacy(String, 'validate_string', $aliases_real) if $publickey == 'USE_DEFAULTS' { $publickey_real = $default_publickey } else { $publickey_real = $publickey } - validate_string($publickey_real) + validate_legacy(String, 'validate_string', $publickey_real) if $netgroup == 'USE_DEFAULTS' { $netgroup_real = $default_netgroup } else { $netgroup_real = $netgroup } - validate_string($netgroup_real) + validate_legacy(String, 'validate_string', $netgroup_real) if $nsswitch_ipnodes == 'USE_DEFAULTS' { $nsswitch_ipnodes_real = $default_nsswitch_ipnodes @@ -237,7 +235,7 @@ } if $nsswitch_ipnodes_real != undef { - validate_string($nsswitch_ipnodes_real) + validate_legacy(String, 'validate_string', $nsswitch_ipnodes_real) } if $nsswitch_printers == 'USE_DEFAULTS' { @@ -247,7 +245,7 @@ } if $nsswitch_printers_real != undef { - validate_string($nsswitch_printers_real) + validate_legacy(String, 'validate_string', $nsswitch_printers_real) } if $nsswitch_auth_attr == 'USE_DEFAULTS' { @@ -257,7 +255,7 @@ } if $nsswitch_auth_attr_real != undef { - validate_string($nsswitch_auth_attr_real) + validate_legacy(String, 'validate_string', $nsswitch_auth_attr_real) } if $nsswitch_prof_attr == 'USE_DEFAULTS' { @@ -267,7 +265,7 @@ } if $nsswitch_prof_attr_real != undef { - validate_string($nsswitch_prof_attr_real) + validate_legacy(String, 'validate_string', $nsswitch_prof_attr_real) } if $nsswitch_project == 'USE_DEFAULTS' { @@ -277,7 +275,7 @@ } if $nsswitch_project_real != undef { - validate_string($nsswitch_project_real) + validate_legacy(String, 'validate_string', $nsswitch_project_real) } file { 'nsswitch_config_file': From 21e70f6d9007dd394f9cce8f120c44e5a8d330ea Mon Sep 17 00:00:00 2001 From: r-savcenko Date: Mon, 23 Oct 2023 14:32:30 +0300 Subject: [PATCH 2/4] Update init.pp --- manifests/init.pp | 100 +++++++++++++--------------------------------- 1 file changed, 28 insertions(+), 72 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 920550f..0ad6d68 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -3,46 +3,36 @@ # This module manages nsswitch. # class nsswitch ( - $config_file = '/etc/nsswitch.conf', - $ensure_ldap = 'absent', - $ensure_vas = 'absent', - $vas_nss_module_passwd = 'vas4', - $vas_nss_module_group = 'vas4', - $vas_nss_module_automount = 'nis', - $vas_nss_module_netgroup = 'nis', - $vas_nss_module_aliases = undef, - $vas_nss_module_services = undef, - $passwd = 'USE_DEFAULTS', - $sudoers = 'USE_DEFAULTS', - $shadow = 'USE_DEFAULTS', - $group = 'USE_DEFAULTS', - $hosts = 'USE_DEFAULTS', - $automount = 'USE_DEFAULTS', - $services = 'USE_DEFAULTS', - $bootparams = 'USE_DEFAULTS', - $aliases = 'USE_DEFAULTS', - $publickey = 'USE_DEFAULTS', - $netgroup = 'USE_DEFAULTS', - $protocols = 'USE_DEFAULTS', - $ethers = 'USE_DEFAULTS', - $rpc = 'USE_DEFAULTS', - $nsswitch_ipnodes = 'USE_DEFAULTS', - $nsswitch_printers = 'USE_DEFAULTS', - $nsswitch_auth_attr = 'USE_DEFAULTS', - $nsswitch_prof_attr = 'USE_DEFAULTS', - $nsswitch_project = 'USE_DEFAULTS', + String $config_file = '/etc/nsswitch.conf', + String $ensure_ldap = 'absent', + String $ensure_vas = 'absent', + String $vas_nss_module_passwd = 'vas4', + String $vas_nss_module_group = 'vas4', + String $vas_nss_module_automount = 'nis', + String $vas_nss_module_netgroup = 'nis', + String $vas_nss_module_aliases = undef, + String $vas_nss_module_services = undef, + String $passwd = 'USE_DEFAULTS', + String $sudoers = 'USE_DEFAULTS', + String $shadow = 'USE_DEFAULTS', + String $group = 'USE_DEFAULTS', + String $hosts = 'USE_DEFAULTS', + String $automount = 'USE_DEFAULTS', + String $services = 'USE_DEFAULTS', + String $bootparams = 'USE_DEFAULTS', + String $aliases = 'USE_DEFAULTS', + String $publickey = 'USE_DEFAULTS', + String $netgroup = 'USE_DEFAULTS', + String $protocols = 'USE_DEFAULTS', + String $ethers = 'USE_DEFAULTS', + String $rpc = 'USE_DEFAULTS', + String $nsswitch_ipnodes = 'USE_DEFAULTS', + String $nsswitch_printers = 'USE_DEFAULTS', + String $nsswitch_auth_attr = 'USE_DEFAULTS', + String $nsswitch_prof_attr = 'USE_DEFAULTS', + String $nsswitch_project = 'USE_DEFAULTS', ) { - validate_legacy(String, 'validate_absolute_path', $config_file) - validate_legacy(String, 'validate_re', $ensure_ldap, '^(present|absent)$', 'Valid values for ensure_ldap are \'absent\' and \'present\'.') - validate_legacy(String, 'validate_re', $ensure_vas, '^(present|absent)$','Valid values for ensure_vas are \'absent\' and \'present\'.') - validate_legacy(String, 'validate_string', $vas_nss_module_passwd) - validate_legacy(String, 'validate_string', $vas_nss_module_group) - validate_legacy(String, 'validate_string', $vas_nss_module_automount) - validate_legacy(String, 'validate_string', $vas_nss_module_netgroup) - validate_legacy(String, 'validate_string', $vas_nss_module_aliases) - validate_legacy(String, 'validate_string', $vas_nss_module_services) - case $::osfamily { 'Debian','Suse': { $default_passwd = 'files' @@ -135,98 +125,84 @@ } else { $passwd_real = $passwd } - validate_legacy(String, 'validate_string', $passwd_real) if $protocols == 'USE_DEFAULTS' { $protocols_real = $default_protocols } else { $protocols_real = $protocols } - validate_legacy(String, 'validate_string', $protocols_real) if $ethers == 'USE_DEFAULTS' { $ethers_real = $default_ethers } else { $ethers_real = $ethers } - validate_legacy(String, 'validate_string', $ethers_real) if $rpc == 'USE_DEFAULTS' { $rpc_real = $default_rpc } else { $rpc_real = $rpc } - validate_legacy(String, 'validate_string', $rpc_real) if $shadow == 'USE_DEFAULTS' { $shadow_real = $default_shadow } else { $shadow_real = $shadow } - validate_legacy(String, 'validate_string', $shadow_real) if $sudoers == 'USE_DEFAULTS' { $sudoers_real = $default_sudoers } else { $sudoers_real = $sudoers } - validate_legacy(String, 'validate_string', $sudoers_real) if $group == 'USE_DEFAULTS' { $group_real = $default_group } else { $group_real = $group } - validate_legacy(String, 'validate_string', $group_real) if $hosts == 'USE_DEFAULTS' { $hosts_real = $default_hosts } else { $hosts_real = $hosts } - validate_legacy(String, 'validate_string', $hosts_real) if $automount == 'USE_DEFAULTS' { $automount_real = $default_automount } else { $automount_real = $automount } - validate_legacy(String, 'validate_string', $automount_real) if $services == 'USE_DEFAULTS' { $services_real = $default_services } else { $services_real = $services } - validate_legacy(String, 'validate_string', $services_real) if $bootparams == 'USE_DEFAULTS' { $bootparams_real = $default_bootparams } else { $bootparams_real = $bootparams } - validate_legacy(String, 'validate_string', $bootparams_real) if $aliases == 'USE_DEFAULTS' { $aliases_real = $default_aliases } else { $aliases_real = $aliases } - validate_legacy(String, 'validate_string', $aliases_real) if $publickey == 'USE_DEFAULTS' { $publickey_real = $default_publickey } else { $publickey_real = $publickey } - validate_legacy(String, 'validate_string', $publickey_real) if $netgroup == 'USE_DEFAULTS' { $netgroup_real = $default_netgroup } else { $netgroup_real = $netgroup } - validate_legacy(String, 'validate_string', $netgroup_real) if $nsswitch_ipnodes == 'USE_DEFAULTS' { $nsswitch_ipnodes_real = $default_nsswitch_ipnodes @@ -234,50 +210,30 @@ $nsswitch_ipnodes_real = $nsswitch_ipnodes } - if $nsswitch_ipnodes_real != undef { - validate_legacy(String, 'validate_string', $nsswitch_ipnodes_real) - } - if $nsswitch_printers == 'USE_DEFAULTS' { $nsswitch_printers_real = $default_nsswitch_printers } else { $nsswitch_printers_real = $nsswitch_printers } - if $nsswitch_printers_real != undef { - validate_legacy(String, 'validate_string', $nsswitch_printers_real) - } - if $nsswitch_auth_attr == 'USE_DEFAULTS' { $nsswitch_auth_attr_real = $default_nsswitch_auth_attr } else { $nsswitch_auth_attr_real = $nsswitch_auth_attr } - if $nsswitch_auth_attr_real != undef { - validate_legacy(String, 'validate_string', $nsswitch_auth_attr_real) - } - if $nsswitch_prof_attr == 'USE_DEFAULTS' { $nsswitch_prof_attr_real = $default_nsswitch_prof_attr } else { $nsswitch_prof_attr_real = $nsswitch_prof_attr } - if $nsswitch_prof_attr_real != undef { - validate_legacy(String, 'validate_string', $nsswitch_prof_attr_real) - } - if $nsswitch_project == 'USE_DEFAULTS' { $nsswitch_project_real = $default_nsswitch_project } else { $nsswitch_project_real = $nsswitch_project } - if $nsswitch_project_real != undef { - validate_legacy(String, 'validate_string', $nsswitch_project_real) - } - file { 'nsswitch_config_file': ensure => file, path => $config_file, From dccb289e461593feba108f17780060c82037dd67 Mon Sep 17 00:00:00 2001 From: r-savcenko Date: Mon, 23 Oct 2023 14:34:49 +0300 Subject: [PATCH 3/4] Update init.pp --- manifests/init.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 0ad6d68..5fccabf 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -10,8 +10,8 @@ String $vas_nss_module_group = 'vas4', String $vas_nss_module_automount = 'nis', String $vas_nss_module_netgroup = 'nis', - String $vas_nss_module_aliases = undef, - String $vas_nss_module_services = undef, + $vas_nss_module_aliases = undef, + $vas_nss_module_services = undef, String $passwd = 'USE_DEFAULTS', String $sudoers = 'USE_DEFAULTS', String $shadow = 'USE_DEFAULTS', From 46ad257ca6efc18dbc56a0d4e89cd583e400ee8b Mon Sep 17 00:00:00 2001 From: r-savcenko Date: Mon, 23 Oct 2023 14:40:01 +0300 Subject: [PATCH 4/4] Update init.pp --- manifests/init.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 5fccabf..c756bf9 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -10,8 +10,8 @@ String $vas_nss_module_group = 'vas4', String $vas_nss_module_automount = 'nis', String $vas_nss_module_netgroup = 'nis', - $vas_nss_module_aliases = undef, - $vas_nss_module_services = undef, + $vas_nss_module_aliases = undef, + $vas_nss_module_services = undef, String $passwd = 'USE_DEFAULTS', String $sudoers = 'USE_DEFAULTS', String $shadow = 'USE_DEFAULTS',