From ba0b5e02fe165ed4d99945f1fd43f7f85de705b0 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Fri, 16 Feb 2024 11:14:55 +0100 Subject: [PATCH 01/30] Puppet 8 compatibility - update gems to use voxpupuli test gem - lint auto fix - update puppet version im metadata.json --- Gemfile | 9 +- manifests/client.pp | 13 +- manifests/client/config.pp | 64 +++++---- manifests/client/mount.pp | 23 ++-- manifests/client/package.pp | 25 ++-- manifests/client/service.pp | 45 +++---- manifests/functions/create_export.pp | 2 +- manifests/functions/mkdir.pp | 2 +- manifests/init.pp | 72 +++++------ manifests/params.pp | 187 +++++++++++++-------------- manifests/server.pp | 31 +++-- manifests/server/config.pp | 60 +++++---- manifests/server/export.pp | 19 +-- manifests/server/package.pp | 13 +- manifests/server/service.pp | 54 ++++---- metadata.json | 2 +- 16 files changed, 286 insertions(+), 335 deletions(-) diff --git a/Gemfile b/Gemfile index e7652ea2..119480ef 100644 --- a/Gemfile +++ b/Gemfile @@ -12,15 +12,8 @@ end group :test do gem 'metadata-json-lint', require: false + gem 'voxpupuli-test' gem 'puppet-blacksmith', require: false, git: 'https://github.com/voxpupuli/puppet-blacksmith.git' - gem 'puppet-lint', require: false, git: 'https://github.com/rodjek/puppet-lint.git' - gem 'puppet-lint-absolute_classname-check', require: false - gem 'puppet-lint-classes_and_types_beginning_with_digits-check', require: false - gem 'puppet-lint-leading_zero-check', require: false - gem 'puppet-lint-trailing_comma-check', require: false - gem 'puppet-lint-unquoted_string-check', require: false - gem 'puppet-lint-variable_contains_upcase', require: false - gem 'puppet-lint-version_comparison-check', require: false gem 'puppet-strings', require: false gem 'puppet-syntax', require: false gem 'puppetlabs_spec_helper', require: false diff --git a/manifests/client.pp b/manifests/client.pp index df5a7569..e171d752 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -16,14 +16,13 @@ # class nfs::client ( - $ensure = $::nfs::ensure, - $nfs_v4 = $::nfs::nfs_v4_client, - $nfs_v4_mount_root = $::nfs::nfs_v4_mount_root, - $nfs_v4_idmap_domain = $::nfs::nfs_v4_idmap_domain, + $ensure = $nfs::ensure, + $nfs_v4 = $nfs::nfs_v4_client, + $nfs_v4_mount_root = $nfs::nfs_v4_mount_root, + $nfs_v4_idmap_domain = $nfs::nfs_v4_idmap_domain, ) { - - anchor {'nfs::client::begin': } - anchor {'nfs::client::end': } + anchor { 'nfs::client::begin': } + anchor { 'nfs::client::end': } # package(s) class { 'nfs::client::package': } diff --git a/manifests/client/config.pp b/manifests/client/config.pp index bf43f53c..6c4e92b3 100644 --- a/manifests/client/config.pp +++ b/manifests/client/config.pp @@ -15,40 +15,37 @@ # class nfs::client::config { - - if $::nfs::client::nfs_v4 { - - if $::nfs::defaults_file != undef { - if $::nfs::client_gssd_options != '' { - $_gssd1_aug = ["set ${::nfs::client_gssdopt_name} \"'${::nfs::client_gssd_options}'\""] + if $nfs::client::nfs_v4 { + if $nfs::defaults_file != undef { + if $nfs::client_gssd_options != '' { + $_gssd1_aug = ["set ${nfs::client_gssdopt_name} \"'${nfs::client_gssd_options}'\""] } else { $_gssd1_aug = undef } - - if $::nfs::client_need_gssd { + if $nfs::client_need_gssd { $_gssd2_aug = ['set NEED_GSSD yes'] } else { $_gssd2_aug = undef } - augeas { $::nfs::defaults_file: - context => "/files/${::nfs::defaults_file}", - changes => delete_undef_values(concat($::nfs::client_idmapd_setting, $_gssd1_aug, $_gssd2_aug)), + augeas { $nfs::defaults_file: + context => "/files/${nfs::defaults_file}", + changes => delete_undef_values(concat($nfs::client_idmapd_setting, $_gssd1_aug, $_gssd2_aug)), } } - if ($::nfs::client_rpcbind_config != undef) and ($::nfs::client_rpcbind_optname != undef) and ($::nfs::client_rpcbind_opts != undef){ - augeas { $::nfs::client_rpcbind_config: - incl => $::nfs::client_rpcbind_config, + if ($nfs::client_rpcbind_config != undef) and ($nfs::client_rpcbind_optname != undef) and ($nfs::client_rpcbind_opts != undef) { + augeas { $nfs::client_rpcbind_config: + incl => $nfs::client_rpcbind_config, lens => 'Shellvars.lns', - context => "/files/${::nfs::client_rpcbind_config}", - changes => "set ${::nfs::client_rpcbind_optname} \"'${::nfs::client_rpcbind_opts}'\"", + context => "/files/${nfs::client_rpcbind_config}", + changes => "set ${nfs::client_rpcbind_optname} \"'${nfs::client_rpcbind_opts}'\"", } } - if $::nfs::client_d9_gssdopt_workaround and $::nfs::client_gssd_service { - file_line{ 'rpc-gssd.service': + if $nfs::client_d9_gssdopt_workaround and $nfs::client_gssd_service { + file_line { 'rpc-gssd.service': path => '/lib/systemd/system/rpc-gssd.service', match => 'EnvironmentFile', line => 'EnvironmentFile=-/etc/default/nfs-common', @@ -59,41 +56,40 @@ } ~> Service['rpc-gssd'] } - if ( $::nfs::server_enabled == false ) or ( $::nfs::server_enabled == true and $::nfs::nfs_v4 == false ) { - if $::nfs::idmapd_file != undef { - - if $::nfs::nfs_v4_idmap_localrealms != '' { - if $::nfs::nfs_v4_idmap_localrealms =~ String { - $_localrealms = $::nfs::nfs_v4_idmap_localrealms + if ( $nfs::server_enabled == false ) or ( $nfs::server_enabled == true and $nfs::nfs_v4 == false ) { + if $nfs::idmapd_file != undef { + if $nfs::nfs_v4_idmap_localrealms != '' { + if $nfs::nfs_v4_idmap_localrealms =~ String { + $_localrealms = $nfs::nfs_v4_idmap_localrealms } else { - $_localrealms = join($::nfs::nfs_v4_idmap_localrealms, ',') + $_localrealms = join($nfs::nfs_v4_idmap_localrealms, ',') } $_aug_localrealm = "set General/Local-Realms ${_localrealms}" } else { $_aug_localrealm = undef } - if $::nfs::nfs_v4_idmap_cache != 0 { - $_cache = "set General/Cache-Expiration ${::nfs::nfs_v4_idmap_cache}" + if $nfs::nfs_v4_idmap_cache != 0 { + $_cache = "set General/Cache-Expiration ${nfs::nfs_v4_idmap_cache}" } else { $_cache = undef } - if $::nfs::manage_nfs_v4_idmap_nobody_mapping { - $_user = "set Mapping/Nobody-User ${::nfs::nfs_v4_idmap_nobody_user}" - $_group = "set Mapping/Nobody-Group ${::nfs::nfs_v4_idmap_nobody_group}" + if $nfs::manage_nfs_v4_idmap_nobody_mapping { + $_user = "set Mapping/Nobody-User ${nfs::nfs_v4_idmap_nobody_user}" + $_group = "set Mapping/Nobody-Group ${nfs::nfs_v4_idmap_nobody_group}" } else { $_user = undef $_group = undef } - $changes = ["set General/Domain ${::nfs::nfs_v4_idmap_domain}", $_aug_localrealm, $_cache, $_user, $_group] + $changes = ["set General/Domain ${nfs::nfs_v4_idmap_domain}", $_aug_localrealm, $_cache, $_user, $_group] $filtered_changes = filter($changes) |$val| { $val =~ NotUndef } - augeas { $::nfs::idmapd_file: - context => "/files/${::nfs::idmapd_file}", + augeas { $nfs::idmapd_file: + context => "/files/${nfs::idmapd_file}", lens => 'Puppet.lns', - incl => $::nfs::idmapd_file, + incl => $nfs::idmapd_file, changes => $filtered_changes, } } diff --git a/manifests/client/mount.pp b/manifests/client/mount.pp index 0ebce331..9101abf0 100644 --- a/manifests/client/mount.pp +++ b/manifests/client/mount.pp @@ -49,7 +49,6 @@ # String. Overwrite mount root if differs from server config # - # === Examples # # class { '::nfs': @@ -77,27 +76,25 @@ $mount = $title, $remounts = false, $atboot = false, - $options_nfsv4 = $::nfs::client_nfsv4_options, - $options_nfs = $::nfs::client_nfs_options, + $options_nfsv4 = $nfs::client_nfsv4_options, + $options_nfs = $nfs::client_nfs_options, $bindmount = undef, $nfstag = undef, - $nfs_v4 = $::nfs::client::nfs_v4, + $nfs_v4 = $nfs::client::nfs_v4, $owner = undef, $group = undef, $mode = undef, $mount_root = undef, - $manage_packages = $::nfs::manage_packages, - $client_packages = $::nfs::effective_client_packages, + $manage_packages = $nfs::manage_packages, + $client_packages = $nfs::effective_client_packages, ) { - if $manage_packages and $client_packages != undef { - $mount_require = [ Nfs::Functions::Mkdir[$mount], Package[$client_packages] ] + $mount_require = [Nfs::Functions::Mkdir[$mount], Package[$client_packages]] } else { - $mount_require = [ Nfs::Functions::Mkdir[$mount] ] + $mount_require = [Nfs::Functions::Mkdir[$mount]] } if $nfs_v4 == true { - if $mount_root == undef { $root = '' } else { @@ -117,7 +114,7 @@ mount { "shared ${sharename} by ${server} on ${mount}": ensure => $ensure, device => "${server}:${sharename}", - fstype => $::nfs::client_nfsv4_fstype, + fstype => $nfs::client_nfsv4_fstype, name => $mount, options => $options_nfsv4, remounts => $remounts, @@ -131,9 +128,7 @@ mount_name => $bindmount, } } - } else { - if $share != undef { $sharename = $share } else { @@ -146,7 +141,7 @@ mount { "shared ${sharename} by ${server} on ${mount}": ensure => $ensure, device => "${server}:${sharename}", - fstype => $::nfs::client_nfs_fstype, + fstype => $nfs::client_nfs_fstype, name => $mount, options => $options_nfs, remounts => $remounts, diff --git a/manifests/client/package.pp b/manifests/client/package.pp index 7e284f22..1a01b27e 100644 --- a/manifests/client/package.pp +++ b/manifests/client/package.pp @@ -15,33 +15,26 @@ # class nfs::client::package { - - if $::nfs::manage_packages { - - if $::nfs::client::nfs_v4 { - - if $::nfs::effective_nfsv4_client_services != undef and $::nfs::manage_client_service { - $notify_services = Service[keys($::nfs::effective_nfsv4_client_services)] + if $nfs::manage_packages { + if $nfs::client::nfs_v4 { + if $nfs::effective_nfsv4_client_services != undef and $nfs::manage_client_service { + $notify_services = Service[keys($nfs::effective_nfsv4_client_services)] } else { $notify_services = undef } - } else { - - if $::nfs::effective_client_services != undef and $::nfs::manage_client_service { - $notify_services = Service[keys($::nfs::effective_client_services)] + if $nfs::effective_client_services != undef and $nfs::manage_client_service { + $notify_services = Service[keys($nfs::effective_client_services)] } else { $notify_services = undef } - } - if $::nfs::effective_client_packages != undef { - package { $::nfs::effective_client_packages: - ensure => $::nfs::client_package_ensure, + if $nfs::effective_client_packages != undef { + package { $nfs::effective_client_packages: + ensure => $nfs::client_package_ensure, notify => $notify_services, } } - } } diff --git a/manifests/client/service.pp b/manifests/client/service.pp index 2eb67eb9..0a9a5b33 100644 --- a/manifests/client/service.pp +++ b/manifests/client/service.pp @@ -15,58 +15,53 @@ # class nfs::client::service { + if $nfs::client::nfs_v4 { + $create_services = $nfs::effective_nfsv4_client_services - if $::nfs::client::nfs_v4 { - - $create_services = $::nfs::effective_nfsv4_client_services - - if $::nfs::server_enabled { - $subscription = [ Concat[$::nfs::exports_file], Augeas[$::nfs::idmapd_file] ] + if $nfs::server_enabled { + $subscription = [Concat[$nfs::exports_file], Augeas[$nfs::idmapd_file]] } else { - if ($::nfs::client_rpcbind_config != undef) - and ($::nfs::client_rpcbind_optname != undef) - and ($::nfs::client_rpcbind_opts != undef) { + if ($nfs::client_rpcbind_config != undef) + and ($nfs::client_rpcbind_optname != undef) + and ($nfs::client_rpcbind_opts != undef) { $subscription = [ - Augeas[$::nfs::idmapd_file], - Augeas[$::nfs::defaults_file], - Augeas[$::nfs::client_rpcbind_config] + Augeas[$nfs::idmapd_file], + Augeas[$nfs::defaults_file], + Augeas[$nfs::client_rpcbind_config] ] } else { $subscription = [ - Augeas[$::nfs::idmapd_file], - Augeas[$::nfs::defaults_file] + Augeas[$nfs::idmapd_file], + Augeas[$nfs::defaults_file] ] } } - } else { + $create_services = $nfs::effective_client_services - $create_services = $::nfs::effective_client_services - - if $::nfs::server_enabled { - $subscription = [ Concat[$::nfs::exports_file] ] + if $nfs::server_enabled { + $subscription = [Concat[$nfs::exports_file]] } else { $subscription = undef } - } $service_defaults = { ensure => running, - enable => $::nfs::client_services_enable, - hasrestart => $::nfs::client_services_hasrestart, - hasstatus => $::nfs::client_services_hasstatus, + enable => $nfs::client_services_enable, + hasrestart => $nfs::client_services_hasrestart, + hasstatus => $nfs::client_services_hasstatus, subscribe => $subscription, } - if $create_services != undef and $::nfs::manage_client_service { + if $create_services != undef and $nfs::manage_client_service { create_resources('service', $create_services, $service_defaults ) } # Redhat ~7.5 workaround (See issue https://github.com/derdanne/puppet-nfs/issues/82) if $facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '7' and versioncmp($facts['os']['release']['full'], '7.5') < 0 { - transition {'stop-rpcbind.service-service': + transition { 'stop-rpcbind.service-service': resource => Service['rpcbind.service'], prior_to => Service['rpcbind.socket'], attributes => { diff --git a/manifests/functions/create_export.pp b/manifests/functions/create_export.pp index a36cb76d..f3f42ffe 100644 --- a/manifests/functions/create_export.pp +++ b/manifests/functions/create_export.pp @@ -45,7 +45,7 @@ $line = "${name} ${join(any2array($clients),' ')}\n" concat::fragment { $name: - target => $::nfs::exports_file, + target => $nfs::exports_file, content => $line, } diff --git a/manifests/functions/mkdir.pp b/manifests/functions/mkdir.pp index 0469c3c5..9fe16844 100644 --- a/manifests/functions/mkdir.pp +++ b/manifests/functions/mkdir.pp @@ -22,7 +22,7 @@ # define nfs::functions::mkdir ( - $ensure = 'present', + $ensure = 'present', ) { if $ensure != 'absent' { exec { "mkdir_recurse_${name}": diff --git a/manifests/init.pp b/manifests/init.pp index ed56423c..b5a62b3a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -209,56 +209,56 @@ # * Daniel Klockenkaemper # -class nfs( +class nfs ( Enum['present', 'absent', 'running', 'stopped', 'disabled'] $ensure = 'present', Boolean $server_enabled = false, Boolean $client_enabled = false, Boolean $storeconfigs_enabled = true, - Boolean $nfs_v4 = $::nfs::params::nfs_v4, - Boolean $nfs_v4_client = $::nfs::params::nfs_v4, - Stdlib::Absolutepath $exports_file = $::nfs::params::exports_file, - Stdlib::Absolutepath $idmapd_file = $::nfs::params::idmapd_file, - Optional[Stdlib::Absolutepath] $defaults_file = $::nfs::params::defaults_file, + Boolean $nfs_v4 = $nfs::params::nfs_v4, + Boolean $nfs_v4_client = $nfs::params::nfs_v4, + Stdlib::Absolutepath $exports_file = $nfs::params::exports_file, + Stdlib::Absolutepath $idmapd_file = $nfs::params::idmapd_file, + Optional[Stdlib::Absolutepath] $defaults_file = $nfs::params::defaults_file, Boolean $manage_packages = true, - Array $server_packages = $::nfs::params::server_packages, + Array $server_packages = $nfs::params::server_packages, String $server_package_ensure = 'installed', - Array $client_packages = $::nfs::params::client_packages, + Array $client_packages = $nfs::params::client_packages, String $client_package_ensure = 'installed', Boolean $manage_server_service = true, Boolean $manage_server_servicehelper = true, Boolean $manage_client_service = true, - String $server_service_name = $::nfs::params::server_service_name, + String $server_service_name = $nfs::params::server_service_name, Enum['present', 'absent', 'running', 'stopped', 'disabled'] $server_service_ensure = 'running', Boolean $server_service_enable = true, - Boolean $server_service_hasrestart = $::nfs::params::server_service_hasrestart, - Boolean $server_service_hasstatus = $::nfs::params::server_service_hasstatus, - Optional[String] $server_service_restart_cmd = $::nfs::params::server_service_restart_cmd, - Optional[Array] $server_nfsv4_servicehelper = $::nfs::params::server_nfsv4_servicehelper, - $client_services = $::nfs::params::client_services, - $client_nfsv4_services = $::nfs::params::client_nfsv4_services, - Boolean $client_services_enable = $::nfs::params::client_services_enable, - Boolean $client_services_hasrestart = $::nfs::params::client_services_hasrestart, - Boolean $client_services_hasstatus = $::nfs::params::client_services_hasstatus, - Array[String] $client_idmapd_setting = $::nfs::params::client_idmapd_setting, - String $client_nfs_fstype = $::nfs::params::client_nfs_fstype, - String $client_nfs_options = $::nfs::params::client_nfs_options, - String $client_nfsv4_fstype = $::nfs::params::client_nfsv4_fstype, - String $client_nfsv4_options = $::nfs::params::client_nfsv4_options, + Boolean $server_service_hasrestart = $nfs::params::server_service_hasrestart, + Boolean $server_service_hasstatus = $nfs::params::server_service_hasstatus, + Optional[String] $server_service_restart_cmd = $nfs::params::server_service_restart_cmd, + Optional[Array] $server_nfsv4_servicehelper = $nfs::params::server_nfsv4_servicehelper, + $client_services = $nfs::params::client_services, + $client_nfsv4_services = $nfs::params::client_nfsv4_services, + Boolean $client_services_enable = $nfs::params::client_services_enable, + Boolean $client_services_hasrestart = $nfs::params::client_services_hasrestart, + Boolean $client_services_hasstatus = $nfs::params::client_services_hasstatus, + Array[String] $client_idmapd_setting = $nfs::params::client_idmapd_setting, + String $client_nfs_fstype = $nfs::params::client_nfs_fstype, + String $client_nfs_options = $nfs::params::client_nfs_options, + String $client_nfsv4_fstype = $nfs::params::client_nfsv4_fstype, + String $client_nfsv4_options = $nfs::params::client_nfsv4_options, Boolean $client_need_gssd = false, Boolean $client_gssd_service = false, - $client_gssd_service_name = $::nfs::params::client_gssd_service_name, - String $client_gssd_options = $::nfs::params::client_gssd_options, - String $client_gssdopt_name = $::nfs::params::client_gssdopt_name, + $client_gssd_service_name = $nfs::params::client_gssd_service_name, + String $client_gssd_options = $nfs::params::client_gssd_options, + String $client_gssdopt_name = $nfs::params::client_gssdopt_name, Boolean $client_d9_gssdopt_workaround = false, - String $nfs_v4_export_root = $::nfs::params::nfs_v4_export_root, - String $nfs_v4_export_root_clients = $::nfs::params::nfs_v4_export_root_clients, - String $nfs_v4_mount_root = $::nfs::params::nfs_v4_mount_root, - String $nfs_v4_idmap_domain = $::nfs::params::nfs_v4_idmap_domain, + String $nfs_v4_export_root = $nfs::params::nfs_v4_export_root, + String $nfs_v4_export_root_clients = $nfs::params::nfs_v4_export_root_clients, + String $nfs_v4_mount_root = $nfs::params::nfs_v4_mount_root, + String $nfs_v4_idmap_domain = $nfs::params::nfs_v4_idmap_domain, Variant[String, Array] $nfs_v4_idmap_localrealms = '', Integer $nfs_v4_idmap_cache = 0, Boolean $manage_nfs_v4_idmap_nobody_mapping = false, - String $nfs_v4_idmap_nobody_user = $::nfs::params::nfs_v4_idmap_nobody_user, - String $nfs_v4_idmap_nobody_group = $::nfs::params::nfs_v4_idmap_nobody_group, + String $nfs_v4_idmap_nobody_user = $nfs::params::nfs_v4_idmap_nobody_user, + String $nfs_v4_idmap_nobody_group = $nfs::params::nfs_v4_idmap_nobody_group, String $nfs_v4_root_export_ensure = 'mounted', Optional[String] $nfs_v4_root_export_mount = undef, Boolean $nfs_v4_root_export_remounts = false, @@ -267,13 +267,11 @@ Optional[String] $nfs_v4_root_export_bindmount = undef, Optional[String] $nfs_v4_root_export_tag = undef, Boolean $nfsv4_bindmount_enable = true, - Optional[Stdlib::Absolutepath] $client_rpcbind_config = $::nfs::params::client_rpcbind_config, - Optional[String] $client_rpcbind_optname = $::nfs::params::client_rpcbind_optname, + Optional[Stdlib::Absolutepath] $client_rpcbind_config = $nfs::params::client_rpcbind_config, + Optional[String] $client_rpcbind_optname = $nfs::params::client_rpcbind_optname, Optional[String] $client_rpcbind_opts = undef, ) inherits nfs::params { - if $server_enabled { - if $server_nfsv4_servicehelper != undef { $effective_nfsv4_client_services = delete($client_nfsv4_services, $server_nfsv4_servicehelper) } else { @@ -282,7 +280,6 @@ $effective_client_services = $client_services $effective_client_packages = difference($client_packages, $server_packages) - } else { if $client_gssd_service and $client_gssd_service_name != undef { $effective_nfsv4_client_services = $client_nfsv4_services + $client_gssd_service_name @@ -292,7 +289,6 @@ $effective_client_services = $client_services $effective_client_packages = $client_packages - } if $server_enabled { diff --git a/manifests/params.pp b/manifests/params.pp index d6eba161..646559f8 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -48,39 +48,39 @@ $exports_file = '/etc/exports' $idmapd_file = '/etc/idmapd.conf' $defaults_file = '/etc/default/nfs-common' - $server_packages = [ 'nfs-common', 'nfs-kernel-server', 'nfs4-acl-tools', 'rpcbind' ] - $client_packages = [ 'nfs-common', 'nfs4-acl-tools', 'rpcbind' ] + $server_packages = ['nfs-common', 'nfs-kernel-server', 'nfs4-acl-tools', 'rpcbind'] + $client_packages = ['nfs-common', 'nfs4-acl-tools', 'rpcbind'] $client_rpcbind_config = '/etc/default/rpcbind' } 'RedHat': { $exports_file = '/etc/exports' $idmapd_file = '/etc/idmapd.conf' $defaults_file = '/etc/sysconfig/nfs' - $server_packages = [ 'nfs-utils', 'nfs4-acl-tools', 'rpcbind' ] - $client_packages = [ 'nfs-utils', 'nfs4-acl-tools', 'rpcbind' ] + $server_packages = ['nfs-utils', 'nfs4-acl-tools', 'rpcbind'] + $client_packages = ['nfs-utils', 'nfs4-acl-tools', 'rpcbind'] $client_rpcbind_config = '/etc/sysconfig/rpcbind' } 'Gentoo': { $exports_file = '/etc/exports' $idmapd_file = '/etc/idmapd.conf' $defaults_file = '/etc/conf.d/nfs' - $server_packages = [ 'net-nds/rpcbind', 'net-fs/nfs-utils', 'net-libs/libnfsidmap' ] - $client_packages = [ 'net-nds/rpcbind', 'net-fs/nfs-utils', 'net-libs/libnfsidmap' ] + $server_packages = ['net-nds/rpcbind', 'net-fs/nfs-utils', 'net-libs/libnfsidmap'] + $client_packages = ['net-nds/rpcbind', 'net-fs/nfs-utils', 'net-libs/libnfsidmap'] $client_rpcbind_config = undef } 'Suse': { $exports_file = '/etc/exports' $idmapd_file = '/etc/idmapd.conf' - $server_packages = [ 'nfs-kernel-server' ] - $client_packages = [ 'nfsidmap', 'nfs-client', 'rpcbind' ] + $server_packages = ['nfs-kernel-server'] + $client_packages = ['nfsidmap', 'nfs-client', 'rpcbind'] $defaults_file = undef $client_rpcbind_config = undef } 'Archlinux': { $exports_file = '/etc/exports' $idmapd_file = '/etc/idmapd.conf' - $server_packages = [ 'nfs-utils' ] - $client_packages = [ 'nfs-utils', 'nfsidmap', 'rpcbind' ] + $server_packages = ['nfs-utils'] + $client_packages = ['nfs-utils', 'nfsidmap', 'rpcbind'] $defaults_file = undef $client_rpcbind_config = undef } @@ -95,7 +95,6 @@ } } - # service parameters # params that are the same on all (known) OSes. $client_nfs_fstype = 'nfs' @@ -119,62 +118,62 @@ case $facts['os']['distro']['codename'] { 'trusty': { - $client_services = {'rpcbind' => {}} - $client_nfsv4_services = {'rpcbind' => {}, 'nfs-common' => { require => Service['rpcbind'] }} + $client_services = { 'rpcbind' => {} } + $client_nfsv4_services = { 'rpcbind' => {}, 'nfs-common' => { require => Service['rpcbind'] } } $client_gssd_service_name = undef $server_nfsv4_servicehelper = undef $server_service_name = 'nfs-kernel-server' $client_gssdopt_name = 'RPCGSSDOPTS' } 'jessie', 'wheezy': { - $client_services = {'rpcbind' => {}} - $client_nfsv4_services = {'rpcbind' => {}, 'nfs-common' => { require => Service['rpcbind'] }} + $client_services = { 'rpcbind' => {} } + $client_nfsv4_services = { 'rpcbind' => {}, 'nfs-common' => { require => Service['rpcbind'] } } $client_gssd_service_name = undef - $server_nfsv4_servicehelper = [ 'nfs-common' ] + $server_nfsv4_servicehelper = ['nfs-common'] $server_service_name = 'nfs-kernel-server' $client_gssdopt_name = 'RPCGSSDOPTS' } 'bullseye', 'buster', 'stretch', 'xenial', 'yakkety', 'zesty': { $client_services = { 'rpcbind' => { - ensure => 'running', - enable => false, - }, - } + ensure => 'running', + enable => false, + }, + } $client_gssd_service_name = { 'rpc-gssd' => { - ensure => 'running', - enable => true, - }, - } + ensure => 'running', + enable => true, + }, + } $client_nfsv4_services = { 'rpcbind' => { - ensure => 'running', - enable => false, - }, - } - $server_nfsv4_servicehelper = [ 'nfs-idmapd' ] + ensure => 'running', + enable => false, + }, + } + $server_nfsv4_servicehelper = ['nfs-idmapd'] $server_service_name = 'nfs-kernel-server' $client_gssdopt_name = 'GSSDARGS' } 'bionic', 'focal', 'jammy', 'kinetic': { - $client_services = {'rpcbind' => {}} + $client_services = { 'rpcbind' => {} } $client_gssd_service_name = { 'rpc-gssd' => { - ensure => 'running', - enable => true, - }, - } - $client_nfsv4_services = {'rpcbind' => {}} + ensure => 'running', + enable => true, + }, + } + $client_nfsv4_services = { 'rpcbind' => {} } $server_nfsv4_servicehelper = undef $server_service_name = 'nfs-kernel-server' $client_gssdopt_name = 'GSSDARGS' } default: { - $client_services = {'rpcbind' => {}} + $client_services = { 'rpcbind' => {} } $client_gssd_service_name = { 'rpc-gssd' => { - ensure => 'running', - enable => true, - }, - } - $client_nfsv4_services = {'rpcbind' => {}} - $server_nfsv4_servicehelper = [ 'idmapd' ] + ensure => 'running', + enable => true, + }, + } + $client_nfsv4_services = { 'rpcbind' => {} } + $server_nfsv4_servicehelper = ['idmapd'] $server_service_name = 'nfs-kernel-server' $client_gssdopt_name = 'GSSDARGS' } @@ -192,40 +191,40 @@ $client_gssdopt_name = 'RPCGSSDARGS' if versioncmp($facts['os']['release']['full'], '7.5') < 0 { $client_services = { 'rpcbind.service' => { - ensure => 'running', - enable => false, - }, - 'rpcbind.socket' => { - ensure => 'running', - enable => true, - }, - } + ensure => 'running', + enable => false, + }, + 'rpcbind.socket' => { + ensure => 'running', + enable => true, + }, + } } else { - $client_services = {'rpcbind.service' => {}} + $client_services = { 'rpcbind.service' => {} } } $client_gssd_service_name = { 'rpc-gssd' => { - ensure => 'running', - enable => true, - }, - } + ensure => 'running', + enable => true, + }, + } $client_nfsv4_fstype = 'nfs4' $client_nfsv4_options = 'tcp,nolock,rsize=32768,wsize=32768,intr,noatime,actimeo=3' if versioncmp($facts['os']['release']['full'], '7.5') < 0 { $client_nfsv4_services = { 'rpcbind.service' => { - ensure => 'running', - enable => false, - }, - 'rpcbind.socket' => { - ensure => 'running', - enable => true, - }, - } + ensure => 'running', + enable => false, + }, + 'rpcbind.socket' => { + ensure => 'running', + enable => true, + }, + } } else { - $client_nfsv4_services = {'rpcbind' => {}} + $client_nfsv4_services = { 'rpcbind' => {} } } - $server_nfsv4_servicehelper = [ 'nfs-idmap.service' ] + $server_nfsv4_servicehelper = ['nfs-idmap.service'] $server_service_name = 'nfs-server.service' } '8': { @@ -233,16 +232,16 @@ $client_nfs_options = 'tcp,nolock,rsize=32768,wsize=32768,intr,noatime,actimeo=3' $client_services_enable = true $client_gssdopt_name = 'RPCGSSDARGS' - $client_services = {'rpcbind.service' => {}} + $client_services = { 'rpcbind.service' => {} } $client_gssd_service_name = { 'rpc-gssd' => { - ensure => 'running', - enable => true, - }, - } + ensure => 'running', + enable => true, + }, + } $client_nfsv4_fstype = 'nfs4' $client_nfsv4_options = 'tcp,nolock,rsize=32768,wsize=32768,intr,noatime,actimeo=3' - $client_nfsv4_services = {'rpcbind' => {}} - $server_nfsv4_servicehelper = [ 'nfs-idmapd.service' ] + $client_nfsv4_services = { 'rpcbind' => {} } + $server_nfsv4_servicehelper = ['nfs-idmapd.service'] $server_service_name = 'nfs-server.service' } '9': { @@ -250,16 +249,16 @@ $client_nfs_options = 'tcp,nolock,rsize=32768,wsize=32768,intr,noatime,actimeo=3' $client_services_enable = true $client_gssdopt_name = 'RPCGSSDARGS' - $client_services = {'rpcbind.service' => {}} + $client_services = { 'rpcbind.service' => {} } $client_gssd_service_name = { 'rpc-gssd' => { - ensure => 'running', - enable => true, - }, - } + ensure => 'running', + enable => true, + }, + } $client_nfsv4_fstype = 'nfs4' $client_nfsv4_options = 'tcp,nolock,rsize=32768,wsize=32768,intr,noatime,actimeo=3' - $client_nfsv4_services = {'rpcbind' => {}} - $server_nfsv4_servicehelper = [ 'nfs-idmapd.service' ] + $client_nfsv4_services = { 'rpcbind' => {} } + $server_nfsv4_servicehelper = ['nfs-idmapd.service'] $server_service_name = 'nfs-server.service' } default: { @@ -267,16 +266,16 @@ $client_idmapd_setting = [''] $client_nfs_options = 'tcp,nolock,rsize=32768,wsize=32768,intr,noatime,actimeo=3' $client_services_enable = true - $client_services = {'rpcbind' => {}} + $client_services = { 'rpcbind' => {} } $client_gssd_service_name = { 'rpc-gssd' => { - ensure => 'running', - enable => true, - }, - } + ensure => 'running', + enable => true, + }, + } $client_nfsv4_fstype = 'nfs4' $client_nfsv4_options = 'tcp,nolock,rsize=32768,wsize=32768,intr,noatime,actimeo=3' - $client_nfsv4_services = {'rpcbind' => {}, 'rpcidmapd' => {}} - $server_nfsv4_servicehelper = [ 'rpcidmapd', 'rpcbind' ] + $client_nfsv4_services = { 'rpcbind' => {}, 'rpcidmapd' => {} } + $server_nfsv4_servicehelper = ['rpcidmapd', 'rpcbind'] $server_service_name = 'nfs' } } @@ -289,12 +288,12 @@ $client_idmapd_setting = ['set NFS_NEEDED_SERVICES rpc.idmapd'] $client_nfs_options = 'tcp,nolock,rsize=32768,wsize=32768,intr,noatime,nfsvers=3,actimeo=3' $client_services_enable = true - $client_services = {'rpcbind' => {} } + $client_services = { 'rpcbind' => {} } $client_gssd_service_name = undef $client_nfsv4_fstype = 'nfs4' $client_nfsv4_options = 'tcp,nolock,rsize=32768,wsize=32768,intr,noatime,nfsvers=4,actimeo=3' - $client_nfsv4_services = {'rpcbind' => {}, 'rpc.idmapd' => {}} - $server_nfsv4_servicehelper = [ 'rpc.idmapd' ] + $client_nfsv4_services = { 'rpcbind' => {}, 'rpc.idmapd' => {} } + $server_nfsv4_servicehelper = ['rpc.idmapd'] $server_service_name = 'nfs' } 'Suse': { @@ -305,11 +304,11 @@ $client_idmapd_setting = [''] $client_nfs_options = 'tcp,nolock,rsize=32768,wsize=32768,intr,noatime,nfsvers=3,actimeo=3' $client_services_enable = true - $client_services = {'rpcbind' => { before => Service['nfs'] }, 'nfs' => {}} + $client_services = { 'rpcbind' => { before => Service['nfs'] }, 'nfs' => {} } $client_gssd_service_name = undef $client_nfsv4_fstype = 'nfs4' $client_nfsv4_options = 'tcp,nolock,rsize=32768,wsize=32768,intr,noatime,nfsvers=4,actimeo=3' - $client_nfsv4_services = {'rpcbind' => { before => Service['nfs'] }, 'nfs' => {}} + $client_nfsv4_services = { 'rpcbind' => { before => Service['nfs'] }, 'nfs' => {} } $server_nfsv4_servicehelper = undef $server_service_name = 'nfsserver' } @@ -321,12 +320,12 @@ $client_idmapd_setting = [''] $client_nfs_options = 'tcp,nolock,rsize=32768,wsize=32768,intr,noatime,nfsvers=3,actimeo=3' $client_services_enable = true - $client_services = {'rpcbind' => {}} + $client_services = { 'rpcbind' => {} } $client_gssd_service_name = undef $client_nfsv4_fstype = 'nfs4' $client_nfsv4_options = 'tcp,nolock,rsize=32768,wsize=32768,intr,noatime,nfsvers=4,actimeo=3' - $client_nfsv4_services = {'rpcbind' => {}} - $server_nfsv4_servicehelper = [ 'nfs-idmapd' ] + $client_nfsv4_services = { 'rpcbind' => {} } + $server_nfsv4_servicehelper = ['nfs-idmapd'] $server_service_name = 'nfs-server.service' } default: { diff --git a/manifests/server.pp b/manifests/server.pp index cb8601f2..68c0b5bf 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -15,22 +15,21 @@ # class nfs::server ( - $ensure = $::nfs::ensure, - $nfs_v4 = $::nfs::nfs_v4, - $nfs_v4_export_root = $::nfs::nfs_v4_export_root, - $nfs_v4_export_root_clients = $::nfs::nfs_v4_export_root_clients, - $nfs_v4_idmap_domain = $::nfs::nfs_v4_idmap_domain, - $nfs_v4_root_export_ensure = $::nfs::nfs_v4_root_export_ensure, - $nfs_v4_root_export_mount = $::nfs::nfs_v4_root_export_mount, - $nfs_v4_root_export_remounts = $::nfs::nfs_v4_root_export_remounts, - $nfs_v4_root_export_atboot = $::nfs::nfs_v4_root_export_atboot , - $nfs_v4_root_export_options = $::nfs::nfs_v4_root_export_options, - $nfs_v4_root_export_bindmount = $::nfs::nfs_v4_root_export_bindmount, - $nfs_v4_root_export_tag = $::nfs::nfs_v4_root_export_tag, -){ - - anchor {'nfs::server::begin': } - anchor {'nfs::server::end': } + $ensure = $nfs::ensure, + $nfs_v4 = $nfs::nfs_v4, + $nfs_v4_export_root = $nfs::nfs_v4_export_root, + $nfs_v4_export_root_clients = $nfs::nfs_v4_export_root_clients, + $nfs_v4_idmap_domain = $nfs::nfs_v4_idmap_domain, + $nfs_v4_root_export_ensure = $nfs::nfs_v4_root_export_ensure, + $nfs_v4_root_export_mount = $nfs::nfs_v4_root_export_mount, + $nfs_v4_root_export_remounts = $nfs::nfs_v4_root_export_remounts, + $nfs_v4_root_export_atboot = $nfs::nfs_v4_root_export_atboot , + $nfs_v4_root_export_options = $nfs::nfs_v4_root_export_options, + $nfs_v4_root_export_bindmount = $nfs::nfs_v4_root_export_bindmount, + $nfs_v4_root_export_tag = $nfs::nfs_v4_root_export_tag, +) { + anchor { 'nfs::server::begin': } + anchor { 'nfs::server::end': } # package(s) class { 'nfs::server::package': } diff --git a/manifests/server/config.pp b/manifests/server/config.pp index 91d3fbb7..cc2c2dea 100644 --- a/manifests/server/config.pp +++ b/manifests/server/config.pp @@ -15,77 +15,75 @@ # class nfs::server::config { - - concat { $::nfs::exports_file: + concat { $nfs::exports_file: ensure => present, } concat::fragment { 'nfs_exports_header': - target => $::nfs::exports_file, + target => $nfs::exports_file, content => "# This file is configured through the nfs::server puppet module\n", order => 1; } - if $::nfs::nfs_v4 { - - if $::nfs::nfsv4_bindmount_enable { + if $nfs::nfs_v4 { + if $nfs::nfsv4_bindmount_enable { concat::fragment { 'nfs_exports_root': - target => $::nfs::exports_file, - content => "${::nfs::server::nfs_v4_export_root} ${::nfs::server::nfs_v4_export_root_clients}\n", + target => $nfs::exports_file, + content => "${nfs::server::nfs_v4_export_root} ${nfs::server::nfs_v4_export_root_clients}\n", order => 2, } } - if ! defined(File[$::nfs::server::nfs_v4_export_root]) { - file { $::nfs::server::nfs_v4_export_root: + if ! defined(File[$nfs::server::nfs_v4_export_root]) { + file { $nfs::server::nfs_v4_export_root: ensure => directory, } } - if $::nfs::nfs_v4_idmap_localrealms != '' { - if $::nfs::nfs_v4_idmap_localrealms =~ String { - $_localrealms = $::nfs::nfs_v4_idmap_localrealms + if $nfs::nfs_v4_idmap_localrealms != '' { + if $nfs::nfs_v4_idmap_localrealms =~ String { + $_localrealms = $nfs::nfs_v4_idmap_localrealms } else { - $_localrealms = join($::nfs::nfs_v4_idmap_localrealms, ',') + $_localrealms = join($nfs::nfs_v4_idmap_localrealms, ',') } $_aug_localrealm = "set General/Local-Realms ${_localrealms}" } else { $_aug_localrealm = undef } - if $::nfs::nfs_v4_idmap_cache != 0 { - $_cache = "set General/Cache-Expiration ${::nfs::nfs_v4_idmap_cache}" + if $nfs::nfs_v4_idmap_cache != 0 { + $_cache = "set General/Cache-Expiration ${nfs::nfs_v4_idmap_cache}" } else { $_cache = undef } - if $::nfs::manage_nfs_v4_idmap_nobody_mapping { - $_user = "set Mapping/Nobody-User ${::nfs::nfs_v4_idmap_nobody_user}" - $_group = "set Mapping/Nobody-Group ${::nfs::nfs_v4_idmap_nobody_group}" + if $nfs::manage_nfs_v4_idmap_nobody_mapping { + $_user = "set Mapping/Nobody-User ${nfs::nfs_v4_idmap_nobody_user}" + $_group = "set Mapping/Nobody-Group ${nfs::nfs_v4_idmap_nobody_group}" } else { $_user = undef $_group = undef } - $changes = ["set General/Domain ${::nfs::server::nfs_v4_idmap_domain}", $_aug_localrealm, $_cache, $_user, $_group] + $changes = ["set General/Domain ${nfs::server::nfs_v4_idmap_domain}", $_aug_localrealm, $_cache, $_user, $_group] $filtered_changes = filter($changes) |$val| { $val =~ NotUndef } - augeas { $::nfs::idmapd_file: - context => "/files/${::nfs::idmapd_file}", + augeas { $nfs::idmapd_file: + context => "/files/${nfs::idmapd_file}", lens => 'Puppet.lns', - incl => $::nfs::idmapd_file, + incl => $nfs::idmapd_file, changes => $filtered_changes, } if $nfs::storeconfigs_enabled { - @@nfs::client::mount { $::nfs::nfs_v4_mount_root: - ensure => $::nfs::server::nfs_v4_root_export_ensure, - server => $::clientcert, - remounts => $::nfs::server::nfs_v4_root_export_remounts, - atboot => $::nfs::server::nfs_v4_root_export_atboot, - options_nfsv4 => $::nfs::server::nfs_v4_root_export_options, - bindmount => $::nfs::server::nfs_v4_root_export_bindmount, - nfstag => $::nfs::server::nfs_v4_root_export_tag, + @@nfs::client::mount { $nfs::nfs_v4_mount_root: + ensure => $nfs::server::nfs_v4_root_export_ensure, + server => $facts['clientcert'], + remounts => $nfs::server::nfs_v4_root_export_remounts, + atboot => $nfs::server::nfs_v4_root_export_atboot, + options_nfsv4 => $nfs::server::nfs_v4_root_export_options, + bindmount => $nfs::server::nfs_v4_root_export_bindmount, + nfstag => $nfs::server::nfs_v4_root_export_tag, } } } diff --git a/manifests/server/export.pp b/manifests/server/export.pp index 84d653d2..82830807 100644 --- a/manifests/server/export.pp +++ b/manifests/server/export.pp @@ -76,7 +76,7 @@ # * Daniel Klockenkaemper # -define nfs::server::export( +define nfs::server::export ( $v3_export_name = $name, $v4_export_name = regsubst($name, '.*/(.*)', '\1' ), $clients = 'localhost(ro)', @@ -87,30 +87,27 @@ $mount = undef, $remounts = false, $atboot = false, - $options_nfsv4 = $::nfs::client_nfsv4_options, - $options_nfs = $::nfs::client_nfs_options, + $options_nfsv4 = $nfs::client_nfsv4_options, + $options_nfs = $nfs::client_nfs_options, $bindmount = undef, $nfstag = undef, $owner = undef, $group = undef, $mode = undef, - $server = $::clientcert, - $nfsv4_bindmount_enable = $::nfs::nfsv4_bindmount_enable, + $server = $facts['clientcert'], + $nfsv4_bindmount_enable = $nfs::nfsv4_bindmount_enable, ) { - if $nfs::server::nfs_v4 { - if $nfsv4_bindmount_enable { $export_name = $v4_export_name - $export_title = "${::nfs::server::nfs_v4_export_root}/${export_name}" - $create_export_require = [ Nfs::Functions::Nfsv4_bindmount[$name] ] + $export_title = "${nfs::server::nfs_v4_export_root}/${export_name}" + $create_export_require = [Nfs::Functions::Nfsv4_bindmount[$name]] nfs::functions::nfsv4_bindmount { $name: ensure => $ensure, v4_export_name => $export_name, bind => $bind, } - } else { $export_name = $name $export_title = $name @@ -145,7 +142,6 @@ } } } else { - if $mount != undef { $mount_name = $mount } else { @@ -171,6 +167,5 @@ server => $server, } } - } } diff --git a/manifests/server/package.pp b/manifests/server/package.pp index 392c9384..19e1290d 100644 --- a/manifests/server/package.pp +++ b/manifests/server/package.pp @@ -15,19 +15,16 @@ # class nfs::server::package { - - if $::nfs::manage_packages { - - if $::nfs::manage_server_service { - $notify_services = Service[$::nfs::server_service_name] + if $nfs::manage_packages { + if $nfs::manage_server_service { + $notify_services = Service[$nfs::server_service_name] } else { $notify_services = undef } - package { $::nfs::server_packages: - ensure => $::nfs::server_package_ensure, + package { $nfs::server_packages: + ensure => $nfs::server_package_ensure, notify => $notify_services, } - } } diff --git a/manifests/server/service.pp b/manifests/server/service.pp index f8eb4898..3bc44009 100644 --- a/manifests/server/service.pp +++ b/manifests/server/service.pp @@ -15,47 +15,43 @@ # class nfs::server::service { - - if $::nfs::nfs_v4 == true { - - if $::nfs::server_nfsv4_servicehelper != undef and $::nfs::manage_server_servicehelper { - $server_service_require = Service[$::nfs::server_nfsv4_servicehelper] - $::nfs::server_nfsv4_servicehelper.each |$service_name| { + if $nfs::nfs_v4 == true { + if $nfs::server_nfsv4_servicehelper != undef and $nfs::manage_server_servicehelper { + $server_service_require = Service[$nfs::server_nfsv4_servicehelper] + $nfs::server_nfsv4_servicehelper.each |$service_name| { service { $service_name: - ensure => $::nfs::server_service_ensure, - enable => $::nfs::server_service_enable, - hasrestart => $::nfs::server_service_hasrestart, - hasstatus => $::nfs::server_service_hasstatus, - subscribe => [ Concat[$::nfs::exports_file], Augeas[$::nfs::idmapd_file] ], + ensure => $nfs::server_service_ensure, + enable => $nfs::server_service_enable, + hasrestart => $nfs::server_service_hasrestart, + hasstatus => $nfs::server_service_hasstatus, + subscribe => [Concat[$nfs::exports_file], Augeas[$nfs::idmapd_file]], } } } else { $server_service_require = undef } - if $::nfs::manage_server_service { - service { $::nfs::server_service_name: - ensure => $::nfs::server_service_ensure, - enable => $::nfs::server_service_enable, - hasrestart => $::nfs::server_service_hasrestart, - hasstatus => $::nfs::server_service_hasstatus, - restart => $::nfs::server_service_restart_cmd, - subscribe => [ Concat[$::nfs::exports_file], Augeas[$::nfs::idmapd_file] ], + if $nfs::manage_server_service { + service { $nfs::server_service_name: + ensure => $nfs::server_service_ensure, + enable => $nfs::server_service_enable, + hasrestart => $nfs::server_service_hasrestart, + hasstatus => $nfs::server_service_hasstatus, + restart => $nfs::server_service_restart_cmd, + subscribe => [Concat[$nfs::exports_file], Augeas[$nfs::idmapd_file]], require => $server_service_require, } } } else { - - if $::nfs::manage_server_service { - service { $::nfs::server_service_name: - ensure => $::nfs::server_service_ensure, - enable => $::nfs::server_service_enable, - hasrestart => $::nfs::server_service_hasrestart, - hasstatus => $::nfs::server_service_hasstatus, - restart => $::nfs::server_service_restart_cmd, - subscribe => Concat[$::nfs::exports_file], + if $nfs::manage_server_service { + service { $nfs::server_service_name: + ensure => $nfs::server_service_ensure, + enable => $nfs::server_service_enable, + hasrestart => $nfs::server_service_hasrestart, + hasstatus => $nfs::server_service_hasstatus, + restart => $nfs::server_service_restart_cmd, + subscribe => Concat[$nfs::exports_file], } } - } } diff --git a/metadata.json b/metadata.json index 0b34eb4e..721792fd 100644 --- a/metadata.json +++ b/metadata.json @@ -72,7 +72,7 @@ "requirements": [ { "name": "puppet", - "version_requirement": ">= 4.0.0 < 8.0.0" + "version_requirement": ">= 4.0.0 < 9.0.0" } ] } From 589677cdb897e8458b3e397e10052316eab10cc2 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Wed, 22 May 2024 13:10:13 +0200 Subject: [PATCH 02/30] use Gemfile from voxpupuli --- Gemfile | 58 ++++++++++++++++----------------------------------------- 1 file changed, 16 insertions(+), 42 deletions(-) diff --git a/Gemfile b/Gemfile index 119480ef..dfa923b2 100644 --- a/Gemfile +++ b/Gemfile @@ -1,55 +1,29 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' -def location_for(place, fake_version = nil) - if place =~ %r{^(git[:@][^#]*)#(.*)} - [fake_version, { git: Regexp.last_match(1), branch: Regexp.last_match(2), require: false }].compact - elsif place =~ /^file:\/\/(.*)/ - ['>= 0', { path: File.expand_path(Regexp.last_match(1)), require: false }] - else - [place, { require: false }] - end -end - group :test do - gem 'metadata-json-lint', require: false - gem 'voxpupuli-test' - gem 'puppet-blacksmith', require: false, git: 'https://github.com/voxpupuli/puppet-blacksmith.git' - gem 'puppet-strings', require: false - gem 'puppet-syntax', require: false - gem 'puppetlabs_spec_helper', require: false - gem 'semantic_puppet', require: false - gem 'rake', require: false - gem 'rspec', require: false - gem 'rspec-core', require: false - gem 'rspec-puppet', require: false, git: 'https://github.com/puppetlabs/rspec-puppet.git' - gem 'rspec-puppet-facts', require: false - gem 'rspec-puppet-utils', require: false - gem 'rubocop', require: false - gem 'rubocop-rspec', require: false - gem 'voxpupuli-release', require: false, git: 'https://github.com/voxpupuli/voxpupuli-release-gem.git' + gem 'voxpupuli-test', '~> 7.0', :require => false + gem 'coveralls', :require => false + gem 'simplecov-console', :require => false + gem 'puppet_metadata', '~> 3.5', :require => false end group :development do - gem 'guard-rake', require: false + gem 'guard-rake', :require => false + gem 'overcommit', '>= 0.39.1', :require => false end -if RUBY_VERSION >= '2.3.0' - group :acceptance do - gem 'beaker' - gem 'beaker-puppet_install_helper' - gem 'beaker-puppet' - gem 'beaker-docker' - gem 'beaker-rspec' - end +group :system_tests do + gem 'voxpupuli-acceptance', '~> 3.0', :require => false end -if facterversion = ENV['FACTER_GEM_VERSION'] - gem 'facter', facterversion.to_s, require: false, groups: [:test] -else - gem 'facter', require: false, groups: [:test] +group :release do + gem 'voxpupuli-release', '~> 3.0', :require => false end -puppetversion = ENV['PUPPET_VERSION'].nil? ? '~> 4.0' : ENV['PUPPET_VERSION'].to_s -gem 'puppet', puppetversion, require: false, groups: [:test] +gem 'rake', :require => false +gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test] + +puppetversion = ENV['PUPPET_GEM_VERSION'] || '~> 7.24' +gem 'puppet', puppetversion, :require => false, :groups => [:test] -# vim:ft=ruby +# vim: syntax=ruby From a111ad302aed09e1967bad934654e9b5a21ecc8a Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Mon, 3 Jun 2024 12:30:51 +0200 Subject: [PATCH 03/30] Update github workflows (based on puppet-gitlab) --- .github/CONTRIBUTING.md | 254 ++++++++++++++++++++++++++++++ .github/ISSUE_TEMPLATE.md | 26 +++ .github/PULL_REQUEST_TEMPLATE.md | 20 +++ .github/workflows/ci.yml | 23 +++ .github/workflows/release.yml | 22 +++ .github/workflows/test-suite.yaml | 127 --------------- 6 files changed, 345 insertions(+), 127 deletions(-) create mode 100644 .github/CONTRIBUTING.md create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml delete mode 100644 .github/workflows/test-suite.yaml diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 00000000..6aaa603f --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,254 @@ +# Contribution guidelines + +## Table of contents + +* [Contributing](#contributing) +* [Writing proper commits - short version](#writing-proper-commits-short-version) +* [Writing proper commits - long version](#writing-proper-commits-long-version) +* [Dependencies](#dependencies) + * [Note for OS X users](#note-for-os-x-users) +* [The test matrix](#the-test-matrix) +* [Syntax and style](#syntax-and-style) +* [Running the unit tests](#running-the-unit-tests) +* [Unit tests in docker](#unit-tests-in-docker) +* [Integration tests](#integration-tests) + +This module has grown over time based on a range of contributions from +people using it. If you follow these contributing guidelines your patch +will likely make it into a release a little more quickly. + +## Contributing + +Please note that this project is released with a Contributor Code of Conduct. +By participating in this project you agree to abide by its terms. +[Contributor Code of Conduct](https://voxpupuli.org/coc/). + +* Fork the repo. +* Create a separate branch for your change. +* We only take pull requests with passing tests, and documentation. [GitHub Actions](https://docs.github.com/en/actions) run the tests for us. You can also execute them locally. This is explained [in a later section](#the-test-matrix). +* Checkout [our docs](https://voxpupuli.org/docs/reviewing_pr/) we use to review a module and the [official styleguide](https://puppet.com/docs/puppet/6.0/style_guide.html). They provide some guidance for new code that might help you before you submit a pull request. +* Add a test for your change. Only refactoring and documentation changes require no new tests. If you are adding functionality or fixing a bug, please add a test. +* Squash your commits down into logical components. Make sure to rebase against our current master. +* Push the branch to your fork and submit a pull request. + +Please be prepared to repeat some of these steps as our contributors review your code. + +Also consider sending in your profile code that calls this component module as an acceptance test or provide it via an issue. This helps reviewers a lot to test your use case and prevents future regressions! + +## Writing proper commits - short version + +* Make commits of logical units. +* Check for unnecessary whitespace with "git diff --check" before committing. +* Commit using Unix line endings (check the settings around "crlf" in git-config(1)). +* Do not check in commented out code or unneeded files. +* The first line of the commit message should be a short description (50 characters is the soft limit, excluding ticket number(s)), and should skip the full stop. +* Associate the issue in the message. The first line should include the issue number in the form "(#XXXX) Rest of message". +* The body should provide a meaningful commit message, which: + *uses the imperative, present tense: `change`, not `changed` or `changes`. + * includes motivation for the change, and contrasts its implementation with the previous behavior. + * Make sure that you have tests for the bug you are fixing, or feature you are adding. + * Make sure the test suites passes after your commit: + * When introducing a new feature, make sure it is properly documented in the README.md + +## Writing proper commits - long version + + 1. Make separate commits for logically separate changes. + + Please break your commits down into logically consistent units + which include new or changed tests relevant to the rest of the + change. The goal of doing this is to make the diff easier to + read for whoever is reviewing your code. In general, the easier + your diff is to read, the more likely someone will be happy to + review it and get it into the code base. + + If you are going to refactor a piece of code, please do so as a + separate commit from your feature or bug fix changes. + + We also really appreciate changes that include tests to make + sure the bug is not re-introduced, and that the feature is not + accidentally broken. + + Describe the technical detail of the change(s). If your + description starts to get too long, that is a good sign that you + probably need to split up your commit into more finely grained + pieces. + + Commits which plainly describe the things which help + reviewers check the patch and future developers understand the + code are much more likely to be merged in with a minimum of + bike-shedding or requested changes. Ideally, the commit message + would include information, and be in a form suitable for + inclusion in the release notes for the version of Puppet that + includes them. + + Please also check that you are not introducing any trailing + whitespace or other "whitespace errors". You can do this by + running "git diff --check" on your changes before you commit. + + 2. Sending your patches + + To submit your changes via a GitHub pull request, we _highly_ + recommend that you have them on a topic branch, instead of + directly on `master`. + It makes things much easier to keep track of, especially if + you decide to work on another thing before your first change + is merged in. + + GitHub has some pretty good + [general documentation](http://help.github.com/) on using + their site. They also have documentation on + [creating pull requests](http://help.github.com/send-pull-requests/). + + In general, after pushing your topic branch up to your + repository on GitHub, you can switch to the branch in the + GitHub UI and click "Pull Request" towards the top of the page + in order to open a pull request. + + + 3. Update the related GitHub issue. + + If there is a GitHub issue associated with the change you + submitted, then you should update the ticket to include the + location of your branch, along with any other commentary you + may wish to make. + +## Dependencies + +The testing and development tools have a bunch of dependencies, +all managed by [bundler](http://bundler.io/) according to the +[Puppet support matrix](http://docs.puppetlabs.com/guides/platforms.html#ruby-versions). + +By default the tests use a baseline version of Puppet. + +If you have Ruby 2.x or want a specific version of Puppet, +you must set an environment variable such as: + +```sh +export PUPPET_GEM_VERSION="~> 6.1.0" +``` + +You can install all needed gems for spec tests into the modules directory by +running: + +```sh +bundle install --path .vendor/ --without development system_tests release --jobs "$(nproc)" +``` + +If you also want to run acceptance tests: + +```sh +bundle install --path .vendor/ --with system_tests --without development release --jobs "$(nproc)" +``` + +Our all in one solution if you don't know if you need to install or update gems: + +```sh +bundle install --path .vendor/ --with system_tests --without development release --jobs "$(nproc)"; bundle update; bundle clean +``` + +As an alternative to the `--jobs "$(nproc)` parameter, you can set an +environment variable: + +```sh +BUNDLE_JOBS="$(nproc)" +``` + +### Note for OS X users + +`nproc` isn't a valid command under OS x. As an alternative, you can do: + +```sh +--jobs "$(sysctl -n hw.ncpu)" +``` + +## The test matrix + +### Syntax and style + +The test suite will run [Puppet Lint](http://puppet-lint.com/) and +[Puppet Syntax](https://github.com/gds-operations/puppet-syntax) to +check various syntax and style things. You can run these locally with: + +```sh +bundle exec rake lint +bundle exec rake validate +``` + +It will also run some [Rubocop](http://batsov.com/rubocop/) tests +against it. You can run those locally ahead of time with: + +```sh +bundle exec rake rubocop +``` + +### Running the unit tests + +The unit test suite covers most of the code, as mentioned above please +add tests if you're adding new functionality. If you've not used +[rspec-puppet](http://rspec-puppet.com/) before then feel free to ask +about how best to test your new feature. + +To run the linter, the syntax checker and the unit tests: + +```sh +bundle exec rake test +``` + +To run your all the unit tests + +```sh +bundle exec rake spec +``` + +To run a specific spec test set the `SPEC` variable: + +```sh +bundle exec rake spec SPEC=spec/foo_spec.rb +``` + +#### Unit tests in docker + +Some people don't want to run the dependencies locally or don't want to install +ruby. We ship a Dockerfile that enables you to run all unit tests and linting. +You only need to run: + +```sh +docker build . +``` + +Please ensure that a docker daemon is running and that your user has the +permission to talk to it. You can specify a remote docker host by setting the +`DOCKER_HOST` environment variable. it will copy the content of the module into +the docker image. So it will not work if a Gemfile.lock exists. + +### Integration tests + +The unit tests just check the code runs, not that it does exactly what +we want on a real machine. For that we're using +[beaker](https://github.com/puppetlabs/beaker). + +This fires up a new virtual machine (using vagrant) and runs a series of +simple tests against it after applying the module. You can run this +with: + +```sh +BEAKER_PUPPET_COLLECTION=puppet7 BEAKER_setfile=debian11-64 bundle exec rake beaker +``` + +You can replace the string `debian11` with any common operating system. +The following strings are known to work: + +* ubuntu2004 +* ubuntu2204 +* debian11 +* centos7 +* centos8 +* centos9 +* almalinux8 +* almalinux9 +* fedora36 + +For more information and tips & tricks, see [voxpupuli-acceptance's documentation](https://github.com/voxpupuli/voxpupuli-acceptance#running-tests). + +The source of this file is in our [modulesync_config](https://github.com/voxpupuli/modulesync_config/blob/master/moduleroot/.github/CONTRIBUTING.md.erb) +repository. diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 00000000..593e7aa8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,26 @@ + + +## Affected Puppet, Ruby, OS and module versions/distributions + +- Puppet: +- Ruby: +- Distribution: +- Module version: + +## How to reproduce (e.g Puppet code you use) + +## What are you seeing + +## What behaviour did you expect instead + +## Output log + +## Any additional information you'd like to impart diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..342807bc --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,20 @@ + +#### Pull Request (PR) description + + +#### This Pull Request (PR) fixes the following issues + diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..7216724f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,23 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +name: CI + +on: + pull_request: {} + push: + branches: + - main + - master + +concurrency: + group: ${{ github.ref_name }} + cancel-in-progress: true + +jobs: + puppet: + name: Puppet + uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v2 + with: + pidfile_workaround: 'false' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..55324aa6 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,22 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +name: Release + +on: + push: + tags: + - '*' + +jobs: + release: + name: Release + uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v2 + with: + allowed_owner: 'voxpupuli' + secrets: + # Configure secrets here: + # https://docs.github.com/en/actions/security-guides/encrypted-secrets + username: ${{ secrets.PUPPET_FORGE_USERNAME }} + api_key: ${{ secrets.PUPPET_FORGE_API_KEY }} diff --git a/.github/workflows/test-suite.yaml b/.github/workflows/test-suite.yaml deleted file mode 100644 index 0dec901b..00000000 --- a/.github/workflows/test-suite.yaml +++ /dev/null @@ -1,127 +0,0 @@ -name: Test suite - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - test-static-current: - strategy: - fail-fast: false - matrix: - puppet: [7.22.0] - ruby: [2.7.7, 3.0.5, 3.1.3] - - name: Static code analysis - runs-on: ubuntu-20.04 - permissions: - contents: read - - steps: - - uses: actions/checkout@v3 - - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - bundler-cache: true - env: - PUPPET_VERSION: ${{ matrix.puppet }} - - - name: Run metadata lint - run: | - PUPPET_VERSION=${{ matrix.puppet }} bundle exec rake metadata_lint - - - name: Run puppet lint - run: | - PUPPET_VERSION=${{ matrix.puppet }} bundle exec rake lint - - - name: Run puppet syntax check - run: | - PUPPET_VERSION=${{ matrix.puppet }} bundle exec rake syntax - - - name: Run puppet rspec tests - run: | - PUPPET_VERSION=${{ matrix.puppet }} STRICT_VARIABLES=yes bundle exec rake spec - - - name: Run rubocop tests - run: | - PUPPET_VERSION=${{ matrix.puppet }} bundle exec rake rubocop - - test-static-old: - strategy: - fail-fast: false - matrix: - puppet: [5.5.22, 6.29.0] - ruby: [2.5.9, 2.6.9] - - name: Static code analysis - runs-on: ubuntu-20.04 - permissions: - contents: read - - steps: - - uses: actions/checkout@v3 - - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - bundler-cache: true - env: - PUPPET_VERSION: ${{ matrix.puppet }} - - - name: Run metadata lint - run: | - PUPPET_VERSION=${{ matrix.puppet }} bundle exec rake metadata_lint - - - name: Run puppet lint - run: | - PUPPET_VERSION=${{ matrix.puppet }} bundle exec rake lint - - - name: Run puppet syntax check - run: | - PUPPET_VERSION=${{ matrix.puppet }} bundle exec rake syntax - - - name: Run puppet rspec tests - run: | - PUPPET_VERSION=${{ matrix.puppet }} STRICT_VARIABLES=yes bundle exec rake spec - - - name: Run rubocop tests - run: | - PUPPET_VERSION=${{ matrix.puppet }} bundle exec rake rubocop - - test-integration: - strategy: - fail-fast: false - matrix: - puppet: [puppet6, puppet7] - beakerset: [ubuntu-18.04, ubuntu-20.04, ubuntu-22.04, centos-7, debian-10, debian-11] - - name: Integration tests - runs-on: ubuntu-20.04 - permissions: - contents: read - - steps: - - uses: actions/checkout@v2 - - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: 2.6.9 - bundler-cache: true - env: - BEAKER_set: ${{ matrix.beakerset }} - BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet }} - PUPPET_INSTALL_TYPE: agent - - - name: Run puppet-beaker tests - run: | - BEAKER_destroy=yes bundle exec rake acceptance - env: - BEAKER_set: ${{ matrix.beakerset }} - BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet }} - PUPPET_INSTALL_TYPE: agent From 8bca4a8bb6978e09355bfd0e2a74e47690382fbb Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Mon, 3 Jun 2024 12:33:04 +0200 Subject: [PATCH 04/30] Ad dmore test files from puppet-gitlab --- .rspec | 5 +++ .rspec_parallel | 4 +++ Gemfile | 3 ++ Rakefile | 88 +++++++++++++++++++++---------------------------- 4 files changed, 50 insertions(+), 50 deletions(-) create mode 100644 .rspec create mode 100644 .rspec_parallel diff --git a/.rspec b/.rspec new file mode 100644 index 00000000..f634583d --- /dev/null +++ b/.rspec @@ -0,0 +1,5 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +--format documentation +--color diff --git a/.rspec_parallel b/.rspec_parallel new file mode 100644 index 00000000..a9a84f85 --- /dev/null +++ b/.rspec_parallel @@ -0,0 +1,4 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +--format progress diff --git a/Gemfile b/Gemfile index dfa923b2..a4a3b204 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,6 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do diff --git a/Rakefile b/Rakefile index 9622eb83..ac8a8dc8 100644 --- a/Rakefile +++ b/Rakefile @@ -1,56 +1,44 @@ -require 'puppetlabs_spec_helper/rake_tasks' -require 'puppet-lint/tasks/puppet-lint' -require 'puppet-syntax/tasks/puppet-syntax' -require 'metadata-json-lint/rake_task' -require 'puppet_blacksmith/rake_tasks' -require 'voxpupuli/release/rake_tasks' -require 'rubocop/rake_task' -require 'puppet-strings/tasks' - -PuppetLint.configuration.send('disable_ensure_first_param') - -RuboCop::RakeTask.new - -PuppetLint::RakeTask.new :lint do |config| - # Pattern of files to ignore - config.ignore_paths = ['Gemfile', 'Rakefile', 'pkg/**/*', 'vendor/**/*', '.vendor/**/*', 'spec/**/*'] - - # List of checks to disable - config.disable_checks = ['disable_class_inherits_from_params_class', '140chars', 'documentation', 'disable_single_quote_string_with_variables'] - - # Should puppet-lint prefix it's output with the file being checked, - # defaults to true - config.with_filename = false - - # Should the task fail if there were any warnings, defaults to false - config.fail_on_warnings = true - - # Format string for puppet-lint's output (see the puppet-lint help output - # for details - config.log_format = '%{filename} - %{message}' - - # Print out the context for the problem, defaults to false - config.with_context = true - - # Enable automatic fixing of problems, defaults to false - config.fix = false +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +# Attempt to load voxpupuli-test (which pulls in puppetlabs_spec_helper), +# otherwise attempt to load it directly. +begin + require 'voxpupuli/test/rake' +rescue LoadError + begin + require 'puppetlabs_spec_helper/rake_tasks' + rescue LoadError + end +end - # Show ignored problems in the output, defaults to false - config.show_ignored = true +# load optional tasks for acceptance +# only available if gem group releases is installed +begin + require 'voxpupuli/acceptance/rake' +rescue LoadError +end - # Compare module layout relative to the module root - config.relative = true +# load optional tasks for releases +# only available if gem group releases is installed +begin + require 'voxpupuli/release/rake_tasks' +rescue LoadError + # voxpupuli-release not present +else + GCGConfig.user = 'voxpupuli' + GCGConfig.project = 'puppet-gitlab' end -desc 'Run acceptance tests' -RSpec::Core::RakeTask.new(:acceptance) do |t| - t.pattern = 'spec/acceptance' +desc "Run main 'test' task and report merged results to coveralls" +task test_with_coveralls: [:test] do + if Dir.exist?(File.expand_path('../lib', __FILE__)) + require 'coveralls/rake/task' + Coveralls::RakeTask.new + Rake::Task['coveralls:push'].invoke + else + puts 'Skipping reporting to coveralls. Module has no lib dir' + end end -desc 'Run metadata_lint, lint, syntax, and spec tests.' -task test: [ - :metadata_lint, - :lint, - :syntax, - :spec -] +# vim: syntax=ruby From de188b88d37343acff239e45f5e2611fac332e4a Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Mon, 3 Jun 2024 14:40:48 +0200 Subject: [PATCH 05/30] lint fixes --- .fixtures.yml | 2 - manifests/client.pp | 49 ++-- manifests/client/config.pp | 31 ++- manifests/client/mount.pp | 80 +++--- manifests/client/package.pp | 14 +- manifests/client/service.pp | 14 +- manifests/functions/bindmount.pp | 27 +-- manifests/functions/create_export.pp | 39 ++- manifests/functions/mkdir.pp | 23 +- manifests/functions/nfsv4_bindmount.pp | 26 +- manifests/init.pp | 323 +++++++++++-------------- manifests/params.pp | 24 +- manifests/server.pp | 60 ++--- manifests/server/export.pp | 79 +++--- 14 files changed, 339 insertions(+), 452 deletions(-) diff --git a/.fixtures.yml b/.fixtures.yml index 73c6493f..75366ce4 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -6,10 +6,8 @@ fixtures: augeasproviders_shellvar: "https://github.com/voxpupuli/puppet-augeasproviders_shellvar.git" augeas_core: repo: "https://github.com/puppetlabs/puppetlabs-augeas_core.git" - puppet_version: ">= 6.0.0" mount_core: repo: "https://github.com/puppetlabs/puppetlabs-mount_core.git" - puppet_version: ">= 6.0.0" transition: "https://github.com/puppetlabs/puppetlabs-transition.git" symlinks: "nfs": "#{source_dir}" diff --git a/manifests/client.pp b/manifests/client.pp index e171d752..b49a4b8b 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -1,29 +1,32 @@ -# == Class: nfs::client +# Class: nfs::client # +# @summary # This class exists to # 1. order the loading of classes # 2. including all needed classes for nfs as a client # -# -# === Links -# -# * {Puppet Docs: Using Parameterized Classes}[http://j.mp/nVpyWY] -# -# -# === Authors -# +# @param ensure +# The ensure parameter is used to determine if the nfs client should be configured +# and running or not. Valid values are 'present' and 'absent'. Default is 'present'. +# @param nfs_v4 +# The nfs_v4 parameter is used to determine if the nfs client should use nfs version 4. +# Valid values are 'true' and 'false'. Default is 'false'. +# @param nfs_v4_mount_root +# The nfs_v4_mount_root parameter is used to determine the root directory for nfs version 4 mounts. +# Default is '/mnt'. +# @param nfs_v4_idmap_domain +# The nfs_v4_idmap_domain parameter is used to determine the domain for nfs version 4 id mapping. +# Default is 'localdomain'. +# @authors # * Daniel Klockenkaemper +# * Martin Alfke # - class nfs::client ( - $ensure = $nfs::ensure, - $nfs_v4 = $nfs::nfs_v4_client, - $nfs_v4_mount_root = $nfs::nfs_v4_mount_root, - $nfs_v4_idmap_domain = $nfs::nfs_v4_idmap_domain, + String $ensure = $nfs::ensure, + String $nfs_v4 = $nfs::nfs_v4_client, + String $nfs_v4_mount_root = $nfs::nfs_v4_mount_root, + String $nfs_v4_idmap_domain = $nfs::nfs_v4_idmap_domain, ) { - anchor { 'nfs::client::begin': } - anchor { 'nfs::client::end': } - # package(s) class { 'nfs::client::package': } @@ -35,18 +38,12 @@ if $ensure == 'present' { # we need the software before configuring it - Anchor['nfs::client::begin'] - -> Class['nfs::client::package'] + Class['nfs::client::package'] -> Class['nfs::client::config'] - # we need the software and a working configuration before running a service - Class['nfs::client::package'] -> Class['nfs::client::service'] - Class['nfs::client::config'] -> Class['nfs::client::service'] - Class['nfs::client::service'] -> Anchor['nfs::client::end'] + -> Class['nfs::client::service'] } else { # make sure all services are getting stopped before software removal - Anchor['nfs::client::begin'] - -> Class['nfs::client::service'] + Class['nfs::client::service'] -> Class['nfs::client::package'] - -> Anchor['nfs::client::end'] } } diff --git a/manifests/client/config.pp b/manifests/client/config.pp index 6c4e92b3..94ad2fea 100644 --- a/manifests/client/config.pp +++ b/manifests/client/config.pp @@ -1,19 +1,12 @@ -# == Class: nfs::client::config -# +# Class: nfs::client::config +# @summary # This Function exists to # 1. configure nfs as a client # -# -# === Links -# -# * {Puppet Docs: Using Parameterized Classes}[http://j.mp/nVpyWY] -# -# -# === Authors -# +# @authors # * Daniel Klockenkaemper +# * Martin Alfke # - class nfs::client::config { if $nfs::client::nfs_v4 { if $nfs::defaults_file != undef { @@ -46,14 +39,18 @@ if $nfs::client_d9_gssdopt_workaround and $nfs::client_gssd_service { file_line { 'rpc-gssd.service': - path => '/lib/systemd/system/rpc-gssd.service', - match => 'EnvironmentFile', - line => 'EnvironmentFile=-/etc/default/nfs-common', - require => Package['nfs-common'], - } ~> exec { 'systemctl daemon-reload': + path => '/lib/systemd/system/rpc-gssd.service', + match => 'EnvironmentFile', + line => 'EnvironmentFile=-/etc/default/nfs-common', + } + exec { 'systemctl daemon-reload': refreshonly => true, path => '/bin', - } ~> Service['rpc-gssd'] + } + Package['nfs-common'] + -> File_line['rpc-gssd.service'] + ~> Exec['systemctl daemon-reload'] + ~> Service['rpc-gssd'] } if ( $nfs::server_enabled == false ) or ( $nfs::server_enabled == true and $nfs::nfs_v4 == false ) { diff --git a/manifests/client/mount.pp b/manifests/client/mount.pp index 9101abf0..8f4142e0 100644 --- a/manifests/client/mount.pp +++ b/manifests/client/mount.pp @@ -1,55 +1,60 @@ -# == Function: nfs::client::mount +# Function: nfs::client::mount # +# @summary # This Function exists to # 1. manage all mounts on a nfs client # -# === Parameters +# Parameters # -# [*server*] +# @param server # String. Sets the ip address of the server with the nfs export # -# [*share*] +# @param share # String. Sets the name of the nfs share on the server # -# [*ensure*] +# @param ensure # String. Sets the ensure parameter of the mount. # -# [*remounts*] +# @param remounts # String. Sets the remounts parameter of the mount. # -# [*atboot*] +# @param atboot # String. Sets the atboot parameter of the mount. # -# [*options_nfsv4*] +# @param options_nfsv4 # String. Sets the mount options for a nfs version 4 mount. # -# [*options_nfs*] +# @param options_nfs # String. Sets the mount options for a nfs mount. # -# [*bindmount*] +# @param bindmount # String. When not undef it will create a bindmount on the node # for the nfs mount. # -# [*nfstag*] +# @param nfstag # String. Sets the nfstag parameter of the mount. # -# [*nfs_v4*] +# param nfs_v4 # Boolean. When set to true, it uses nfs version 4 to mount a share. # -# [*owner*] +# @param owner # String. Set owner of mount dir # -# [*group*] +# @param group # String. Set group of mount dir # -# [*mode*] +# @param mode # String. Set mode of mount dir # -# [*mount_root*] +# @param mount_root # String. Overwrite mount root if differs from server config # - -# === Examples +# @param mount +# @param manage_packages +# @param client_packages +# @param nfs_v4 +# +# @examples # # class { '::nfs': # client_enabled => true, @@ -64,29 +69,28 @@ # options_nfsv4 => 'tcp,nolock,rsize=32768,wsize=32768,intr,noatime,actimeo=3' # } # -# === Authors -# +# @authors # * Daniel Klockenkaemper +# * Martin Alfke # - define nfs::client::mount ( - $server, - $share = undef, - $ensure = 'mounted', - $mount = $title, - $remounts = false, - $atboot = false, - $options_nfsv4 = $nfs::client_nfsv4_options, - $options_nfs = $nfs::client_nfs_options, - $bindmount = undef, - $nfstag = undef, - $nfs_v4 = $nfs::client::nfs_v4, - $owner = undef, - $group = undef, - $mode = undef, - $mount_root = undef, - $manage_packages = $nfs::manage_packages, - $client_packages = $nfs::effective_client_packages, + String[1] $server, + Optional[String[1]] $share = undef, + String[1] $ensure = 'mounted', + String[1] $mount = $title, + Boolean $remounts = false, + Boolean $atboot = false, + String[1] $options_nfsv4 = $nfs::client_nfsv4_options, + String[1] $options_nfs = $nfs::client_nfs_options, + Optional[String[1]] $bindmount = undef, + Optional[String[1]] $nfstag = undef, + Boolean $nfs_v4 = $nfs::client::nfs_v4, + Optional[String[1]] $owner = undef, + Optional[String[1]] $group = undef, + Optional[String[1]] $mode = undef, + Optional[String[1]] $mount_root = undef, + Boolean $manage_packages = $nfs::manage_packages, + Optional[Variant[String[1], Array[String[1]]]] $client_packages = $nfs::effective_client_packages, ) { if $manage_packages and $client_packages != undef { $mount_require = [Nfs::Functions::Mkdir[$mount], Package[$client_packages]] diff --git a/manifests/client/package.pp b/manifests/client/package.pp index 1a01b27e..5b6aa44b 100644 --- a/manifests/client/package.pp +++ b/manifests/client/package.pp @@ -1,19 +1,13 @@ -# == Class: nfs::client::package +# Class: nfs::client::package # +# @summary # This Function exists to # 1. install needed packages for nfs clients # -# -# === Links -# -# * {Puppet Docs: Using Parameterized Classes}[http://j.mp/nVpyWY] -# -# -# === Authors -# +# @authors # * Daniel Klockenkaemper +# * Martin Alfke # - class nfs::client::package { if $nfs::manage_packages { if $nfs::client::nfs_v4 { diff --git a/manifests/client/service.pp b/manifests/client/service.pp index 0a9a5b33..613684f9 100644 --- a/manifests/client/service.pp +++ b/manifests/client/service.pp @@ -1,19 +1,13 @@ -# == Class: nfs::client::service +# Class: nfs::client::service # +# @summary # This Function exists to # 1. manage the needed services for nfs clients # -# -# === Links -# -# * {Puppet Docs: Using Parameterized Classes}[http://j.mp/nVpyWY] -# -# -# === Authors -# +# @authors # * Daniel Klockenkaemper +# * Martin Alfke # - class nfs::client::service { if $nfs::client::nfs_v4 { $create_services = $nfs::effective_nfsv4_client_services diff --git a/manifests/functions/bindmount.pp b/manifests/functions/bindmount.pp index a309ddd6..455aa3b1 100644 --- a/manifests/functions/bindmount.pp +++ b/manifests/functions/bindmount.pp @@ -1,33 +1,22 @@ -# == Function: nfs::functions::bindmount +# Function: nfs::functions::bindmount # +# @summary # This Function exists to # 1. manage bindmounts # -# === Parameters -# -# [*mount_name*] +# @param mount_name # String. Sets the target directory for the bindmount # -# [*ensure*] +# @param ensure # String. Sets if enabled or not. # -# === Examples -# -# This Function should not be called directly. -# -# === Links -# -# * {Puppet Docs: Using Parameterized Classes}[http://j.mp/nVpyWY] -# -# -# === Authors -# +# @authors # * Daniel Klockenkaemper +# * Martin Alfke # - define nfs::functions::bindmount ( - $mount_name = undef, - $ensure = 'present', + Optional[String[1]] $mount_name = undef, + String[1] $ensure = 'present', ) { nfs::functions::mkdir { $mount_name: ensure => $ensure, diff --git a/manifests/functions/create_export.pp b/manifests/functions/create_export.pp index f3f42ffe..ff74b26c 100644 --- a/manifests/functions/create_export.pp +++ b/manifests/functions/create_export.pp @@ -1,45 +1,34 @@ -# == Function: nfs::functions::create_export +# Function: nfs::functions::create_export # +# @summary # This Function exists to # 1. manage export creation # -# === Parameters -# -# [*clients*] +# @param clients # String or Array. Sets the clients allowed to mount the export with options. # -# [*ensure*] +# @param ensure # String. Sets if enabled or not. # -# [*owner*] +# @param owner # String. Sets the owner of the exported directory. # -# [*group*] +# @param group # String. Sets the group of the exported directory. # -# [*mode*] +# @param mode # String. Sets the permissions of the exported directory. # -# === Examples -# -# This Function should not be called directly. -# -# === Links -# -# * {Puppet Docs: Using Parameterized Classes}[http://j.mp/nVpyWY] -# -# -# === Authors -# +# @authors # * Daniel Klockenkaemper +# * Martin Alfke # - define nfs::functions::create_export ( - $clients, - $ensure = 'present', - $owner = undef, - $group = undef, - $mode = undef, + Variant[String[1], Array[String[1]]] $clients, + String[1] $ensure = 'present', + Optional[String[1]] $owner = undef, + Optional[String[1]] $group = undef, + Optional[String[1]] $mode = undef, ) { if $ensure != 'absent' { $line = "${name} ${join(any2array($clients),' ')}\n" diff --git a/manifests/functions/mkdir.pp b/manifests/functions/mkdir.pp index 9fe16844..fe0a6a67 100644 --- a/manifests/functions/mkdir.pp +++ b/manifests/functions/mkdir.pp @@ -1,28 +1,17 @@ -# == Function: nfs::functions::mkdir +# Function: nfs::functions::mkdir # +# @summary # This Function exists to # 1. manage dir creation # -# === Parameters -# -# None -# -# === Examples -# -# This Function should not be called directly. -# -# === Links -# -# * {Puppet Docs: Using Parameterized Classes}[http://j.mp/nVpyWY] -# -# -# === Authors +# @param ensure # +# @authors # * Daniel Klockenkaemper +# * Martin Alfke # - define nfs::functions::mkdir ( - $ensure = 'present', + String[1] $ensure = 'present', ) { if $ensure != 'absent' { exec { "mkdir_recurse_${name}": diff --git a/manifests/functions/nfsv4_bindmount.pp b/manifests/functions/nfsv4_bindmount.pp index 104386f5..0934d2fe 100644 --- a/manifests/functions/nfsv4_bindmount.pp +++ b/manifests/functions/nfsv4_bindmount.pp @@ -1,37 +1,27 @@ -# == Function: nfs::functions::nfsv4_bindmount +# Function: nfs::functions::nfsv4_bindmount # +# @summary # This Function exists to # 1. manage bindmounts for nfs4 # -# === Parameters -# -# [*v4_export_name*] +# @param v4_export_name # String. Sets the target directory for the bindmount # -# [*bind*] +# @param bind # String. Sets the bindmount options. # -# [*ensure*] +# @param ensure # String. Sets if mounted or not. # -# === Examples -# -# This Function should not be called directly. -# -# === Links -# -# * {Puppet Docs: Using Parameterized Classes}[http://j.mp/nVpyWY] -# -# # === Authors # # * Daniel Klockenkaemper # define nfs::functions::nfsv4_bindmount ( - $v4_export_name, - $bind, - $ensure = 'mounted', + String[1] $v4_export_name, + String[1] $bind, + String[1] $ensure = 'mounted', ) { $normalize_export_root = regsubst($nfs::server::nfs_v4_export_root, '/$', '') $expdir = "${normalize_export_root}/${v4_export_name}" diff --git a/manifests/init.pp b/manifests/init.pp index b5a62b3a..b0e50746 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,9 +1,6 @@ -# == Class: nfs::init +# Class: nfs::init # -# This class exists to -# === Parameters -# -# [*ensure*] +# @param ensure # String. Controls if the managed resources shall be present or # absent. If set to absent: # * The managed software packages are being uninstalled. @@ -16,260 +13,218 @@ # (e.g. removal of created users, services, changed log settings, ...). # * This is thus destructive and should be used with care. # Defaults to present. -# -# [*server_enabled*] +# @param server_enabled # Boolean. If set to true, this module will configure the node # to act as a nfs server. -# -# [*client_enabled*] +# @param client_enabled # Boolean. If set to true, this module will configure the node # to act as a client server, you can use the exported mount resources # from configured servers. -# -# [*storeconfigs_enabled*] +# @param storeconfigs_enabled # Boolean. If set to false, this module will not export any # resources as storeconfigs. Defaults to true. -# -# [*nfs_v4*] +# @param nfs_v4 # Boolean. If set to true, this module will use nfs version 4 # for exporting and mounting nfs resources. -# -# [*nfs_v4_client*] +# @param nfs_v4_client # Boolean. If set to true, this module will use nfs version 4 # for mounting nfs resources. If set to false it will use nfs -# version 3 to mount nfs resources. It defaults to the setting of [*nfs_v4*] -# -# [*exports_file*] +# version 3 to mount nfs resources. It defaults to the setting of @param nfs_v4 +# @param exports_file # String. It defines the location of file with the nfs export resources used # by the nfs server. -# -# [*idmapd_file*] +# @param idmapd_file # String. It defines the location of the file with the idmapd settings. -# -# [*defaults_file*] +# @param defaults_file # String. It defines the location of the file with the nfs settings. -# -# [*manage_packages*] +# @param manage_packages # Boolean. It defines if the packages should be managed through this module -# -# [*server_packages*] +# @param server_packages # Array. It defines the packages needed to be installed for acting as # a nfs server -# -# [*server_package_ensure*] +# @param server_package_ensure # String. It defines the packages state - any of present, installed, # absent, purged, held, latest -# -# [*client_packages*] +# @param client_packages # Array. It defines the packages needed to be installed for acting as # a nfs client -# -# [*client_package_ensure*] +# @param client_package_ensure # String. It defines the packages state - any of present, installed, # absent, purged, held, latest -# -# [*manage_server_service*] +# @param manage_server_service # Boolean. Defines if module should manage server_service -# -# [*manage_server_servicehelper*] +# @param manage_server_servicehelper # Boolean. Defines if module should manage server_servicehelper -# -# [*manage_client_service*] +# @param manage_client_service # Boolean. Defines if module should manage client_service -# -# [*server_service_name*] +# @param server_service_name # String. It defines the servicename of the nfs server service -# -# [*server_service_ensure*] +# @param server_service_ensure # Boolean. It defines the service parameter ensure for nfs server services. -# -# [*server_service_enable*] +# @param server_service_enable # Boolean. It defines the service parameter enable for nfs server service. -# -# [*server_service_hasrestart*] +# @param server_service_hasrestart # Boolean. It defines the service parameter hasrestart for nfs server service. -# -# [*server_service_hasstatus*] +# @param server_service_hasstatus # Boolean. It defines the service parameter hasstatus for nfs server service. -# -# [*server_service_restart_cmd*] +# @param server_service_restart_cmd # String. It defines the service parameter restart for nfs server service. -# -# [*server_nfsv4_servicehelper*] +# @param server_nfsv4_servicehelper # Array. It defines the service helper like idmapd for servers configured with # nfs version 4. -# -# [*client_services*] +# @param client_services # Nested Hash. It defines the servicenames need to be started when acting as a nfs client -# -# [*client_nfsv4_services*] +# @param client_nfsv4_services # Nested Hash. It defines the servicenames need to be started when acting as a nfs client # version 4. -# -# [*client_services_enable*] +# @param client_services_enable # Boolean. It defines the service parameter enable for nfs client services. -# -# [*client_service_hasrestart*] -# Boolean. It defines the service parameter hasrestart for nfs client services. -# -# [*client_service_hasstatus*] -# Boolean. It defines the service parameter hasstatus for nfs client services. -# -# [*client_idmapd_setting*] -# Array. It defines the Augeas parameter added in [*defaults_file*] when acting as a nfs +# @param client_idmapd_setting +# Array. It defines the Augeas parameter added in @param defaults_file when acting as a nfs # version 4 client. -# -# [*client_nfs_fstype*] +# @param client_nfs_fstype # String. It defines the name of the nfs filesystem, when adding entries to /etc/fstab # on a client node. -# -# [*client_nfs_options*] +# @param client_nfs_options # String. It defines the options for the nfs filesystem, when adding entries to /etc/fstab # on a client node. -# -# [*client_nfsv4_fstype*] +# @param client_nfsv4_fstype # String. It defines the name of the nfs version 4 filesystem, when adding entries # to /etc/fstab on a client node. -# -# [*client_nfsv4_options*] +# @param client_nfsv4_options # String. It defines the options for the nfs version 4filesystem, when adding entries # to /etc/fstab on a client node. -# -# [*nfs_v4_export_root*] +# @param nfs_v4_export_root # String. It defines the location where nfs version 4 exports should be bindmounted to # on a server node. Defaults to /export. -# -# [*nfs_v4_export_root_clients*] +# @param nfs_v4_export_root_clients # String. It defines the clients that are allowed to mount nfs version 4 exports and # includes the option string. Defaults to # *.${::domain}(ro,fsid=root,insecure,no_subtree_check,async,root_squash). -# -# [*nfs_v4_mount_root*] +# @param nfs_v4_mount_root # String. It defines the location where nfs version 4 clients find the mount root # on a server node. Defaults to /srv. -# -# [*nfs_v4_idmap_domain*] -# String. It defines the name of the idmapd domain setting in [*idmapd_file*] needed +# @param nfs_v4_idmap_domain +# String. It defines the name of the idmapd domain setting in @param idmapd_file needed # to be set to the same value on a server and client node to do correct uid and gid # mapping. Defaults to $::domain. -# -# [*nfsv4_bindmount_enable*] +# @param nfsv4_bindmount_enable # Boolean. It defines if the module should create a bindmount for the export. # Defaults to true. -# -# [*client_need_gssd*] +# @param client_need_gssd # Boolean. If true, sets NEED_GSSD=yes in /etc/defauls/nfs-common, usable on Debian/Ubuntu -# -# [*client_gssd_service*] +# @param client_gssd_service # Boolean. If true enable rpc-gssd service. -# -# [*client_gssd_options*] +# @param client_gssd_options # String. Options for rpc-gssd service. Defaults to '' -# -# [*client_d9_gssdopt_workaround*] +# @param client_d9_gssdopt_workaround # Boolean. If enabled, workaround for passing gssd_options which is broken on Debian 9. Usable only on Debian 9 -# -# [*nfs_v4_idmap_localrealms*] +# @param nfs_v4_idmap_localrealms # String or Array. 'Local-Realms' option for idmapd. Defaults to '' -# -# [*nfs_v4_idmap_cache*] +# @param nfs_v4_idmap_cache # Integer. 'Cache-Expiration' option for idmapd. Defaults to 0 - unused. -# -# [*manage_nfs_v4_idmap_nobody_mapping*] +# @param manage_nfs_v4_idmap_nobody_mapping # Boolean. Enable setting Nobody mapping in idmapd. Defaults to false. -# -# [*nfs_v4_idmap_nobody_user*] +# @param nfs_v4_idmap_nobody_user # String. 'Nobody-User' option for idmapd. Defaults to nobody. -# -# [*nfs_v4_idmap_nobody_group*] +# @param nfs_v4_idmap_nobody_group # String. 'Nobody-Group' option for idmapd. Defaults to nobody or nogroup. -# -# [*client_rpcbind_config*] +# @param client_rpcbind_config # String. It defines the location of the file with the rpcbind config. -# -# [*client_rpcbind_optname*] +# @param client_rpcbind_optname # String. It defines the name of env variable that holds the rpcbind config. E.g. OPTIONS for Debian -# -# [*client_rpcbind_opts*] +# @param client_rpcbind_opts # String. Options for rpcbind service. +# @param nfs_v4_root_export_ensure +# String. It defines the state of the nfs version 4 root export. Defaults to mounted. +# @param nfs_v4_root_export_mount +# String. It defines the mountpoint of the nfs version 4 root export. Defaults to undef. +# @param nfs_v4_root_export_remounts +# Boolean. It defines if the nfs version 4 root export should be remounted. Defaults to false. +# @param nfs_v4_root_export_atboot +# Boolean. It defines if the nfs version 4 root export should be mounted at boot. Defaults to false. +# @param nfs_v4_root_export_options +# String. It defines the options for the nfs version 4 root export. Defaults to _netdev. +# @param nfs_v4_root_export_bindmount +# String. It defines the bindmount of the nfs version 4 root export. Defaults to undef. +# @param nfs_v4_root_export_tag +# String. It defines the tag of the nfs version 4 root export. Defaults to undef. +# @param client_gssd_service_name +# Hash. It defines the servicename of the rpc-gssd service. +# @param client_services_hasrestart +# Boolean. It defines the service parameter hasrestart for nfs client services. +# @param client_services_hasstatus +# Boolean. It defines the service parameter hasstatus for nfs client services. +# @param client_gssdopt_name +# String. It defines the name of the gssd option in /etc/default/nfs-common. +# @examples +# * {Please take a look at} [https://github.com/voxpupuli/puppet-nfs#examples] # -# -# === Examples -# -# * {Please take a look at} [https://github.com/derdanne/puppet-nfs#examples] -# -# -# === Links -# -# * {Puppet Docs: Using Parameterized Classes}[http://j.mp/nVpyWY] -# -# -# === Authors -# +# @authors # * Daniel Klockenkaemper +# * Martin Alfke # - class nfs ( - Enum['present', 'absent', 'running', 'stopped', 'disabled'] $ensure = 'present', - Boolean $server_enabled = false, - Boolean $client_enabled = false, - Boolean $storeconfigs_enabled = true, - Boolean $nfs_v4 = $nfs::params::nfs_v4, - Boolean $nfs_v4_client = $nfs::params::nfs_v4, - Stdlib::Absolutepath $exports_file = $nfs::params::exports_file, - Stdlib::Absolutepath $idmapd_file = $nfs::params::idmapd_file, - Optional[Stdlib::Absolutepath] $defaults_file = $nfs::params::defaults_file, - Boolean $manage_packages = true, - Array $server_packages = $nfs::params::server_packages, - String $server_package_ensure = 'installed', - Array $client_packages = $nfs::params::client_packages, - String $client_package_ensure = 'installed', - Boolean $manage_server_service = true, - Boolean $manage_server_servicehelper = true, - Boolean $manage_client_service = true, - String $server_service_name = $nfs::params::server_service_name, - Enum['present', 'absent', 'running', 'stopped', 'disabled'] $server_service_ensure = 'running', - Boolean $server_service_enable = true, - Boolean $server_service_hasrestart = $nfs::params::server_service_hasrestart, - Boolean $server_service_hasstatus = $nfs::params::server_service_hasstatus, - Optional[String] $server_service_restart_cmd = $nfs::params::server_service_restart_cmd, - Optional[Array] $server_nfsv4_servicehelper = $nfs::params::server_nfsv4_servicehelper, - $client_services = $nfs::params::client_services, - $client_nfsv4_services = $nfs::params::client_nfsv4_services, - Boolean $client_services_enable = $nfs::params::client_services_enable, - Boolean $client_services_hasrestart = $nfs::params::client_services_hasrestart, - Boolean $client_services_hasstatus = $nfs::params::client_services_hasstatus, - Array[String] $client_idmapd_setting = $nfs::params::client_idmapd_setting, - String $client_nfs_fstype = $nfs::params::client_nfs_fstype, - String $client_nfs_options = $nfs::params::client_nfs_options, - String $client_nfsv4_fstype = $nfs::params::client_nfsv4_fstype, - String $client_nfsv4_options = $nfs::params::client_nfsv4_options, - Boolean $client_need_gssd = false, - Boolean $client_gssd_service = false, - $client_gssd_service_name = $nfs::params::client_gssd_service_name, - String $client_gssd_options = $nfs::params::client_gssd_options, - String $client_gssdopt_name = $nfs::params::client_gssdopt_name, - Boolean $client_d9_gssdopt_workaround = false, - String $nfs_v4_export_root = $nfs::params::nfs_v4_export_root, - String $nfs_v4_export_root_clients = $nfs::params::nfs_v4_export_root_clients, - String $nfs_v4_mount_root = $nfs::params::nfs_v4_mount_root, - String $nfs_v4_idmap_domain = $nfs::params::nfs_v4_idmap_domain, - Variant[String, Array] $nfs_v4_idmap_localrealms = '', - Integer $nfs_v4_idmap_cache = 0, - Boolean $manage_nfs_v4_idmap_nobody_mapping = false, - String $nfs_v4_idmap_nobody_user = $nfs::params::nfs_v4_idmap_nobody_user, - String $nfs_v4_idmap_nobody_group = $nfs::params::nfs_v4_idmap_nobody_group, - String $nfs_v4_root_export_ensure = 'mounted', - Optional[String] $nfs_v4_root_export_mount = undef, - Boolean $nfs_v4_root_export_remounts = false, - Boolean $nfs_v4_root_export_atboot = false, - String $nfs_v4_root_export_options = '_netdev', - Optional[String] $nfs_v4_root_export_bindmount = undef, - Optional[String] $nfs_v4_root_export_tag = undef, - Boolean $nfsv4_bindmount_enable = true, - Optional[Stdlib::Absolutepath] $client_rpcbind_config = $nfs::params::client_rpcbind_config, - Optional[String] $client_rpcbind_optname = $nfs::params::client_rpcbind_optname, - Optional[String] $client_rpcbind_opts = undef, + Enum['present', 'absent', 'running', 'stopped', 'disabled'] $ensure = 'present', + Boolean $server_enabled = false, + Boolean $client_enabled = false, + Boolean $storeconfigs_enabled = true, + Boolean $nfs_v4 = $nfs::params::nfs_v4, + Boolean $nfs_v4_client = $nfs::params::nfs_v4, + Stdlib::Absolutepath $exports_file = $nfs::params::exports_file, + Stdlib::Absolutepath $idmapd_file = $nfs::params::idmapd_file, + Optional[Stdlib::Absolutepath] $defaults_file = $nfs::params::defaults_file, + Boolean $manage_packages = true, + Array $server_packages = $nfs::params::server_packages, + String $server_package_ensure = 'installed', + Array $client_packages = $nfs::params::client_packages, + String $client_package_ensure = 'installed', + Boolean $manage_server_service = true, + Boolean $manage_server_servicehelper = true, + Boolean $manage_client_service = true, + String $server_service_name = $nfs::params::server_service_name, + Enum['present', 'absent', 'running', 'stopped', 'disabled'] $server_service_ensure = 'running', + Boolean $server_service_enable = true, + Boolean $server_service_hasrestart = $nfs::params::server_service_hasrestart, + Boolean $server_service_hasstatus = $nfs::params::server_service_hasstatus, + Optional[String] $server_service_restart_cmd = $nfs::params::server_service_restart_cmd, + Optional[Array] $server_nfsv4_servicehelper = $nfs::params::server_nfsv4_servicehelper, + Hash $client_services = $nfs::params::client_services, + Hash $client_nfsv4_services = $nfs::params::client_nfsv4_services, + Boolean $client_services_enable = $nfs::params::client_services_enable, + Boolean $client_services_hasrestart = $nfs::params::client_services_hasrestart, + Boolean $client_services_hasstatus = $nfs::params::client_services_hasstatus, + Array[String] $client_idmapd_setting = $nfs::params::client_idmapd_setting, + String $client_nfs_fstype = $nfs::params::client_nfs_fstype, + String $client_nfs_options = $nfs::params::client_nfs_options, + String $client_nfsv4_fstype = $nfs::params::client_nfsv4_fstype, + String $client_nfsv4_options = $nfs::params::client_nfsv4_options, + Boolean $client_need_gssd = false, + Boolean $client_gssd_service = false, + Optional[Hash] $client_gssd_service_name = $nfs::params::client_gssd_service_name, + String $client_gssd_options = $nfs::params::client_gssd_options, + String $client_gssdopt_name = $nfs::params::client_gssdopt_name, + Boolean $client_d9_gssdopt_workaround = false, + String $nfs_v4_export_root = $nfs::params::nfs_v4_export_root, + String $nfs_v4_export_root_clients = $nfs::params::nfs_v4_export_root_clients, + String $nfs_v4_mount_root = $nfs::params::nfs_v4_mount_root, + String $nfs_v4_idmap_domain = $nfs::params::nfs_v4_idmap_domain, + Variant[String, Array] $nfs_v4_idmap_localrealms = '', # lint:ignore:params_empty_string_assignment + Integer $nfs_v4_idmap_cache = 0, + Boolean $manage_nfs_v4_idmap_nobody_mapping = false, + String $nfs_v4_idmap_nobody_user = $nfs::params::nfs_v4_idmap_nobody_user, + String $nfs_v4_idmap_nobody_group = $nfs::params::nfs_v4_idmap_nobody_group, + String $nfs_v4_root_export_ensure = 'mounted', + Optional[String] $nfs_v4_root_export_mount = undef, + Boolean $nfs_v4_root_export_remounts = false, + Boolean $nfs_v4_root_export_atboot = false, + String $nfs_v4_root_export_options = '_netdev', + Optional[String] $nfs_v4_root_export_bindmount = undef, + Optional[String] $nfs_v4_root_export_tag = undef, + Boolean $nfsv4_bindmount_enable = true, + Optional[Stdlib::Absolutepath] $client_rpcbind_config = $nfs::params::client_rpcbind_config, + Optional[String] $client_rpcbind_optname = $nfs::params::client_rpcbind_optname, + Optional[String] $client_rpcbind_opts = undef, ) inherits nfs::params { if $server_enabled { if $server_nfsv4_servicehelper != undef { diff --git a/manifests/params.pp b/manifests/params.pp index 646559f8..4ba905f0 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -1,5 +1,6 @@ -# == Class: nfs::params +# Class: nfs::params # +# @summary # This class exists to # 1. Declutter the default value assignment for class parameters. # 2. Manage internally used module variables in a central place. @@ -7,27 +8,10 @@ # Therefore, many operating system dependent differences (names, paths, ...) # are addressed in here. # -# -# === Parameters -# -# This class does not provide any parameters. -# -# -# === Examples -# -# This class is not intended to be used directly. -# -# -# === Links -# -# * {Puppet Docs: Using Parameterized Classes}[http://j.mp/nVpyWY] -# -# -# === Authors -# +# @authors # * Daniel Klockenkaemper +# * Martin Alfke # - class nfs::params { #### Default values for the parameters of the main module class, init.pp diff --git a/manifests/server.pp b/manifests/server.pp index 68c0b5bf..29517f42 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -1,36 +1,44 @@ -# == Class: nfs::server +# @summary Class: nfs::server # # This class exists to # 1. order the loading of classes # 2. including all needed classes for nfs as a server # -# === Links +# Links # # * {Puppet Docs: Using Parameterized Classes}[http://j.mp/nVpyWY] # +# @param ensure +# @param nfs_v4 +# @param nfs_v4_export_root +# @param nfs_v4_export_root_clients +# @param nfs_v4_idmap_domain +# @param nfs_v4_root_export_ensure +# @param nfs_v4_root_export_mount +# @param nfs_v4_root_export_remounts +# @param nfs_v4_root_export_atboot +# @param nfs_v4_root_export_options +# @param nfs_v4_root_export_bindmount +# @param nfs_v4_root_export_tag # -# === Authors -# +# @authors # * Daniel Klockenkaemper +# * Martin Alfke # - class nfs::server ( - $ensure = $nfs::ensure, - $nfs_v4 = $nfs::nfs_v4, - $nfs_v4_export_root = $nfs::nfs_v4_export_root, - $nfs_v4_export_root_clients = $nfs::nfs_v4_export_root_clients, - $nfs_v4_idmap_domain = $nfs::nfs_v4_idmap_domain, - $nfs_v4_root_export_ensure = $nfs::nfs_v4_root_export_ensure, - $nfs_v4_root_export_mount = $nfs::nfs_v4_root_export_mount, - $nfs_v4_root_export_remounts = $nfs::nfs_v4_root_export_remounts, - $nfs_v4_root_export_atboot = $nfs::nfs_v4_root_export_atboot , - $nfs_v4_root_export_options = $nfs::nfs_v4_root_export_options, - $nfs_v4_root_export_bindmount = $nfs::nfs_v4_root_export_bindmount, - $nfs_v4_root_export_tag = $nfs::nfs_v4_root_export_tag, + Enum['present', 'absent', 'running', 'stopped', 'disabled'] $ensure = $nfs::ensure, + Boolean $nfs_v4 = $nfs::nfs_v4, + String $nfs_v4_export_root = $nfs::nfs_v4_export_root, + String $nfs_v4_export_root_clients = $nfs::nfs_v4_export_root_clients, + String $nfs_v4_idmap_domain = $nfs::nfs_v4_idmap_domain, + String $nfs_v4_root_export_ensure = $nfs::nfs_v4_root_export_ensure, + Optional[String] $nfs_v4_root_export_mount = $nfs::nfs_v4_root_export_mount, + Boolean $nfs_v4_root_export_remounts = $nfs::nfs_v4_root_export_remounts, + Boolean $nfs_v4_root_export_atboot = $nfs::nfs_v4_root_export_atboot , + String $nfs_v4_root_export_options = $nfs::nfs_v4_root_export_options, + Optional[String] $nfs_v4_root_export_bindmount = $nfs::nfs_v4_root_export_bindmount, + Optional[String] $nfs_v4_root_export_tag = $nfs::nfs_v4_root_export_tag, ) { - anchor { 'nfs::server::begin': } - anchor { 'nfs::server::end': } - # package(s) class { 'nfs::server::package': } @@ -42,18 +50,12 @@ if $ensure == 'present' { # we need the software before configuring it - Anchor['nfs::server::begin'] - -> Class['nfs::server::package'] + Class['nfs::server::package'] -> Class['nfs::server::config'] - # we need the software and a working configuration before running a service - Class['nfs::server::package'] -> Class['nfs::server::service'] - Class['nfs::server::config'] -> Class['nfs::server::service'] - Class['nfs::server::service'] -> Anchor['nfs::server::end'] + -> Class['nfs::server::service'] } else { # make sure all services are getting stopped before software removal - Anchor['nfs::server::begin'] - -> Class['nfs::server::service'] + Class['nfs::server::service'] -> Class['nfs::server::package'] - -> Anchor['nfs::server::end'] } } diff --git a/manifests/server/export.pp b/manifests/server/export.pp index 82830807..7e559d61 100644 --- a/manifests/server/export.pp +++ b/manifests/server/export.pp @@ -1,58 +1,63 @@ -# == Function: nfs::server::export +# Function: nfs::server::export # +# @summary # This Function exists to # 1. manage all exported resources on a nfs server # -# === Parameters +# Parameters # -# [*clients*] +# @param clients # String or Array. Sets the allowed clients and options for the export in the exports file. # Defaults to localhost(ro) # -# [*bind*] +# @param bind # String. Sets the bind options setted in /etc/fstab for the bindmounts created. # Defaults to rbind # -# [*ensure*] +# @param ensure # String. If enabled the mount will be created. Defaults to mounted # -# [*remounts*] +# @param remounts # String. Sets the remounts parameter of the mount. # -# [*atboot*] +# @param atboot # String. Sets the atboot parameter of the mount. # -# [*options_nfsv4*] +# @param options_nfsv4 # String. Sets the mount options for a nfs version 4 exported resource mount. # -# [*options_nfs*] +# @param options_nfs # String. Sets the mount options for a nfs exported resource mount. # -# [*bindmount*] +# @param bindmount # String. When not undef it will create a bindmount on the node # for the nfs mount. # -# [*nfstag*] +# @param nfstag # String. Sets the nfstag parameter of the mount. # -# [*mount*] +# @param mount # String. Sets the mountpoint the client will mount the exported resource mount on. If undef # it defaults to the same path as on the server # -# [*owner*] +# @param owner # String. Sets the owner of the exported directory # -# [*group*] +# @param group # String. Sets the group of the exported directory # -# [*mode*] +# @param mode # String. Sets the permissions of the exported directory. # -# [*server*] +# @param server # String. Sets the hostname clients will use to mount the exported resource. If undef it # defaults to the trusted certname # -# === Examples +# @param v3_export_name +# @param v4_export_name +# @param nfsv4_bindmount_enable +# +# @examples # # class { '::nfs': # server_enabled => true, @@ -66,36 +71,36 @@ # share => 'share_name_on_nfs_server', # } # -# === Links +# Links # # * {Puppet Docs: Using Parameterized Classes}[http://j.mp/nVpyWY] # # -# === Authors +# @authors # # * Daniel Klockenkaemper +# * Martin Alfke # - define nfs::server::export ( - $v3_export_name = $name, - $v4_export_name = regsubst($name, '.*/(.*)', '\1' ), - $clients = 'localhost(ro)', - $bind = 'rbind', + String[1] $v3_export_name = $name, + String[1] $v4_export_name = regsubst($name, '.*/(.*)', '\1' ), + String[1] $clients = 'localhost(ro)', + String[1] $bind = 'rbind', # globals for this share # propogated to storeconfigs - $ensure = 'mounted', - $mount = undef, - $remounts = false, - $atboot = false, - $options_nfsv4 = $nfs::client_nfsv4_options, - $options_nfs = $nfs::client_nfs_options, - $bindmount = undef, - $nfstag = undef, - $owner = undef, - $group = undef, - $mode = undef, - $server = $facts['clientcert'], - $nfsv4_bindmount_enable = $nfs::nfsv4_bindmount_enable, + String[1] $ensure = 'mounted', + Optional[String[1]] $mount = undef, + Boolean $remounts = false, + Boolean $atboot = false, + String[1] $options_nfsv4 = $nfs::client_nfsv4_options, + String[1] $options_nfs = $nfs::client_nfs_options, + Optional[String[1]] $bindmount = undef, + Optional[String[1]] $nfstag = undef, + Optional[String[1]] $owner = undef, + Optional[String[1]] $group = undef, + Optional[String[1]] $mode = undef, + String[1] $server = $facts['clientcert'], + Boolean $nfsv4_bindmount_enable = $nfs::nfsv4_bindmount_enable, ) { if $nfs::server::nfs_v4 { if $nfsv4_bindmount_enable { From 2a66dc45f203decf55079404a27c9b25ec6d1ce9 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Mon, 3 Jun 2024 14:49:10 +0200 Subject: [PATCH 06/30] lint updates --- .gitignore | 3 +- REFERENCE.md | 1404 ++++++++++++++++++++++++ manifests/client.pp | 2 +- manifests/client/config.pp | 2 +- manifests/client/mount.pp | 4 +- manifests/client/package.pp | 2 +- manifests/client/service.pp | 2 +- manifests/functions/bindmount.pp | 2 +- manifests/functions/create_export.pp | 2 +- manifests/functions/mkdir.pp | 2 +- manifests/functions/nfsv4_bindmount.pp | 5 +- manifests/init.pp | 4 +- manifests/params.pp | 2 +- manifests/server.pp | 7 +- manifests/server/config.pp | 14 +- manifests/server/export.pp | 2 +- manifests/server/package.pp | 14 +- manifests/server/service.pp | 14 +- 18 files changed, 1434 insertions(+), 53 deletions(-) create mode 100644 REFERENCE.md diff --git a/.gitignore b/.gitignore index fff68df7..f66d302b 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ vendor/ .vendor/ spec/fixtures/ pkg/ -log/ \ No newline at end of file +log/ +.yardoc diff --git a/REFERENCE.md b/REFERENCE.md new file mode 100644 index 00000000..72c292dc --- /dev/null +++ b/REFERENCE.md @@ -0,0 +1,1404 @@ +# Reference + + + +## Table of Contents + +### Classes + +* [`nfs`](#nfs): Class: nfs::init * {Please take a look at} [https://github.com/voxpupuli/puppet-nfs#examples] * Daniel Klockenkaemper * +* [`nfs::client::package`](#nfs--client--package): Class: nfs::client::package This Function exists to 1. install needed packages for nfs clients * Daniel Klockenkaemper * Ma +* [`nfs::server::package`](#nfs--server--package): Class: nfs::server::package This Function exists to 1. install needed packages for nfs server * Daniel Klockenkaemper +* [`nfs::functions::create_export`](#nfs--functions--create_export): Function: nfs::functions::create_export This Function exists to 1. manage export creation * Daniel Klockenkaemper * +* [`nfs::functions::nfsv4_bindmount`](#nfs--functions--nfsv4_bindmount): Function: nfs::functions::nfsv4_bindmount This Function exists to 1. manage bindmounts for nfs4 * Daniel Klockenkaemper `nfs` + +Class: nfs::init + +* {Please take a look at} [https://github.com/voxpupuli/puppet-nfs#examples] + +* Daniel Klockenkaemper +* Martin Alfke + +#### Parameters + +The following parameters are available in the `nfs` class: + +* [`ensure`](#-nfs--ensure) +* [`server_enabled`](#-nfs--server_enabled) +* [`client_enabled`](#-nfs--client_enabled) +* [`storeconfigs_enabled`](#-nfs--storeconfigs_enabled) +* [`nfs_v4`](#-nfs--nfs_v4) +* [`nfs_v4_client`](#-nfs--nfs_v4_client) +* [`exports_file`](#-nfs--exports_file) +* [`idmapd_file`](#-nfs--idmapd_file) +* [`defaults_file`](#-nfs--defaults_file) +* [`manage_packages`](#-nfs--manage_packages) +* [`server_packages`](#-nfs--server_packages) +* [`server_package_ensure`](#-nfs--server_package_ensure) +* [`client_packages`](#-nfs--client_packages) +* [`client_package_ensure`](#-nfs--client_package_ensure) +* [`manage_server_service`](#-nfs--manage_server_service) +* [`manage_server_servicehelper`](#-nfs--manage_server_servicehelper) +* [`manage_client_service`](#-nfs--manage_client_service) +* [`server_service_name`](#-nfs--server_service_name) +* [`server_service_ensure`](#-nfs--server_service_ensure) +* [`server_service_enable`](#-nfs--server_service_enable) +* [`server_service_hasrestart`](#-nfs--server_service_hasrestart) +* [`server_service_hasstatus`](#-nfs--server_service_hasstatus) +* [`server_service_restart_cmd`](#-nfs--server_service_restart_cmd) +* [`server_nfsv4_servicehelper`](#-nfs--server_nfsv4_servicehelper) +* [`client_services`](#-nfs--client_services) +* [`client_nfsv4_services`](#-nfs--client_nfsv4_services) +* [`client_services_enable`](#-nfs--client_services_enable) +* [`client_idmapd_setting`](#-nfs--client_idmapd_setting) +* [`client_nfs_fstype`](#-nfs--client_nfs_fstype) +* [`client_nfs_options`](#-nfs--client_nfs_options) +* [`client_nfsv4_fstype`](#-nfs--client_nfsv4_fstype) +* [`client_nfsv4_options`](#-nfs--client_nfsv4_options) +* [`nfs_v4_export_root`](#-nfs--nfs_v4_export_root) +* [`nfs_v4_export_root_clients`](#-nfs--nfs_v4_export_root_clients) +* [`nfs_v4_mount_root`](#-nfs--nfs_v4_mount_root) +* [`nfs_v4_idmap_domain`](#-nfs--nfs_v4_idmap_domain) +* [`nfsv4_bindmount_enable`](#-nfs--nfsv4_bindmount_enable) +* [`client_need_gssd`](#-nfs--client_need_gssd) +* [`client_gssd_service`](#-nfs--client_gssd_service) +* [`client_gssd_options`](#-nfs--client_gssd_options) +* [`client_d9_gssdopt_workaround`](#-nfs--client_d9_gssdopt_workaround) +* [`nfs_v4_idmap_localrealms`](#-nfs--nfs_v4_idmap_localrealms) +* [`nfs_v4_idmap_cache`](#-nfs--nfs_v4_idmap_cache) +* [`manage_nfs_v4_idmap_nobody_mapping`](#-nfs--manage_nfs_v4_idmap_nobody_mapping) +* [`nfs_v4_idmap_nobody_user`](#-nfs--nfs_v4_idmap_nobody_user) +* [`nfs_v4_idmap_nobody_group`](#-nfs--nfs_v4_idmap_nobody_group) +* [`client_rpcbind_config`](#-nfs--client_rpcbind_config) +* [`client_rpcbind_optname`](#-nfs--client_rpcbind_optname) +* [`client_rpcbind_opts`](#-nfs--client_rpcbind_opts) +* [`nfs_v4_root_export_ensure`](#-nfs--nfs_v4_root_export_ensure) +* [`nfs_v4_root_export_mount`](#-nfs--nfs_v4_root_export_mount) +* [`nfs_v4_root_export_remounts`](#-nfs--nfs_v4_root_export_remounts) +* [`nfs_v4_root_export_atboot`](#-nfs--nfs_v4_root_export_atboot) +* [`nfs_v4_root_export_options`](#-nfs--nfs_v4_root_export_options) +* [`nfs_v4_root_export_bindmount`](#-nfs--nfs_v4_root_export_bindmount) +* [`nfs_v4_root_export_tag`](#-nfs--nfs_v4_root_export_tag) +* [`client_gssd_service_name`](#-nfs--client_gssd_service_name) +* [`client_services_hasrestart`](#-nfs--client_services_hasrestart) +* [`client_services_hasstatus`](#-nfs--client_services_hasstatus) +* [`client_gssdopt_name`](#-nfs--client_gssdopt_name) + +##### `ensure` + +Data type: `Enum['present', 'absent', 'running', 'stopped', 'disabled']` + +String. Controls if the managed resources shall be present or +absent. If set to absent: +* The managed software packages are being uninstalled. +* Any traces of the packages will be purged as good as possible. This may + include existing configuration files. The exact behavior is provider + dependent. Q.v.: + * Puppet type reference: {package, "purgeable"}[http://j.mp/xbxmNP] + * {Puppet's package provider source code}[http://j.mp/wtVCaL] +* System modifications (if any) will be reverted as good as possible + (e.g. removal of created users, services, changed log settings, ...). +* This is thus destructive and should be used with care. +Defaults to present. + +Default value: `'present'` + +##### `server_enabled` + +Data type: `Boolean` + +Boolean. If set to true, this module will configure the node +to act as a nfs server. + +Default value: `false` + +##### `client_enabled` + +Data type: `Boolean` + +Boolean. If set to true, this module will configure the node +to act as a client server, you can use the exported mount resources +from configured servers. + +Default value: `false` + +##### `storeconfigs_enabled` + +Data type: `Boolean` + +Boolean. If set to false, this module will not export any +resources as storeconfigs. Defaults to true. + +Default value: `true` + +##### `nfs_v4` + +Data type: `Boolean` + +Boolean. If set to true, this module will use nfs version 4 +for exporting and mounting nfs resources. + +Default value: `$nfs::params::nfs_v4` + +##### `nfs_v4_client` + +Data type: `Boolean` + +Boolean. If set to true, this module will use nfs version 4 +for mounting nfs resources. If set to false it will use nfs +version 3 to mount nfs resources. It defaults to the setting of @param nfs_v4 + +Default value: `$nfs::params::nfs_v4` + +##### `exports_file` + +Data type: `Stdlib::Absolutepath` + +String. It defines the location of file with the nfs export resources used +by the nfs server. + +Default value: `$nfs::params::exports_file` + +##### `idmapd_file` + +Data type: `Stdlib::Absolutepath` + +String. It defines the location of the file with the idmapd settings. + +Default value: `$nfs::params::idmapd_file` + +##### `defaults_file` + +Data type: `Optional[Stdlib::Absolutepath]` + +String. It defines the location of the file with the nfs settings. + +Default value: `$nfs::params::defaults_file` + +##### `manage_packages` + +Data type: `Boolean` + +Boolean. It defines if the packages should be managed through this module + +Default value: `true` + +##### `server_packages` + +Data type: `Array` + +Array. It defines the packages needed to be installed for acting as +a nfs server + +Default value: `$nfs::params::server_packages` + +##### `server_package_ensure` + +Data type: `String` + +String. It defines the packages state - any of present, installed, +absent, purged, held, latest + +Default value: `'installed'` + +##### `client_packages` + +Data type: `Array` + +Array. It defines the packages needed to be installed for acting as +a nfs client + +Default value: `$nfs::params::client_packages` + +##### `client_package_ensure` + +Data type: `String` + +String. It defines the packages state - any of present, installed, +absent, purged, held, latest + +Default value: `'installed'` + +##### `manage_server_service` + +Data type: `Boolean` + +Boolean. Defines if module should manage server_service + +Default value: `true` + +##### `manage_server_servicehelper` + +Data type: `Boolean` + +Boolean. Defines if module should manage server_servicehelper + +Default value: `true` + +##### `manage_client_service` + +Data type: `Boolean` + +Boolean. Defines if module should manage client_service + +Default value: `true` + +##### `server_service_name` + +Data type: `String` + +String. It defines the servicename of the nfs server service + +Default value: `$nfs::params::server_service_name` + +##### `server_service_ensure` + +Data type: `Enum['present', 'absent', 'running', 'stopped', 'disabled']` + +Boolean. It defines the service parameter ensure for nfs server services. + +Default value: `'running'` + +##### `server_service_enable` + +Data type: `Boolean` + +Boolean. It defines the service parameter enable for nfs server service. + +Default value: `true` + +##### `server_service_hasrestart` + +Data type: `Boolean` + +Boolean. It defines the service parameter hasrestart for nfs server service. + +Default value: `$nfs::params::server_service_hasrestart` + +##### `server_service_hasstatus` + +Data type: `Boolean` + +Boolean. It defines the service parameter hasstatus for nfs server service. + +Default value: `$nfs::params::server_service_hasstatus` + +##### `server_service_restart_cmd` + +Data type: `Optional[String]` + +String. It defines the service parameter restart for nfs server service. + +Default value: `$nfs::params::server_service_restart_cmd` + +##### `server_nfsv4_servicehelper` + +Data type: `Optional[Array]` + +Array. It defines the service helper like idmapd for servers configured with +nfs version 4. + +Default value: `$nfs::params::server_nfsv4_servicehelper` + +##### `client_services` + +Data type: `Hash` + +Nested Hash. It defines the servicenames need to be started when acting as a nfs client + +Default value: `$nfs::params::client_services` + +##### `client_nfsv4_services` + +Data type: `Hash` + +Nested Hash. It defines the servicenames need to be started when acting as a nfs client +version 4. + +Default value: `$nfs::params::client_nfsv4_services` + +##### `client_services_enable` + +Data type: `Boolean` + +Boolean. It defines the service parameter enable for nfs client services. + +Default value: `$nfs::params::client_services_enable` + +##### `client_idmapd_setting` + +Data type: `Array[String]` + +Array. It defines the Augeas parameter added in @param defaults_file when acting as a nfs +version 4 client. + +Default value: `$nfs::params::client_idmapd_setting` + +##### `client_nfs_fstype` + +Data type: `String` + +String. It defines the name of the nfs filesystem, when adding entries to /etc/fstab +on a client node. + +Default value: `$nfs::params::client_nfs_fstype` + +##### `client_nfs_options` + +Data type: `String` + +String. It defines the options for the nfs filesystem, when adding entries to /etc/fstab +on a client node. + +Default value: `$nfs::params::client_nfs_options` + +##### `client_nfsv4_fstype` + +Data type: `String` + +String. It defines the name of the nfs version 4 filesystem, when adding entries +to /etc/fstab on a client node. + +Default value: `$nfs::params::client_nfsv4_fstype` + +##### `client_nfsv4_options` + +Data type: `String` + +String. It defines the options for the nfs version 4filesystem, when adding entries +to /etc/fstab on a client node. + +Default value: `$nfs::params::client_nfsv4_options` + +##### `nfs_v4_export_root` + +Data type: `String` + +String. It defines the location where nfs version 4 exports should be bindmounted to +on a server node. Defaults to /export. + +Default value: `$nfs::params::nfs_v4_export_root` + +##### `nfs_v4_export_root_clients` + +Data type: `String` + +String. It defines the clients that are allowed to mount nfs version 4 exports and +includes the option string. Defaults to +*.${::domain}(ro,fsid=root,insecure,no_subtree_check,async,root_squash). + +Default value: `$nfs::params::nfs_v4_export_root_clients` + +##### `nfs_v4_mount_root` + +Data type: `String` + +String. It defines the location where nfs version 4 clients find the mount root +on a server node. Defaults to /srv. + +Default value: `$nfs::params::nfs_v4_mount_root` + +##### `nfs_v4_idmap_domain` + +Data type: `String` + +String. It defines the name of the idmapd domain setting in @param idmapd_file needed +to be set to the same value on a server and client node to do correct uid and gid +mapping. Defaults to $::domain. + +Default value: `$nfs::params::nfs_v4_idmap_domain` + +##### `nfsv4_bindmount_enable` + +Data type: `Boolean` + +Boolean. It defines if the module should create a bindmount for the export. +Defaults to true. + +Default value: `true` + +##### `client_need_gssd` + +Data type: `Boolean` + +Boolean. If true, sets NEED_GSSD=yes in /etc/defauls/nfs-common, usable on Debian/Ubuntu + +Default value: `false` + +##### `client_gssd_service` + +Data type: `Boolean` + +Boolean. If true enable rpc-gssd service. + +Default value: `false` + +##### `client_gssd_options` + +Data type: `String` + +String. Options for rpc-gssd service. Defaults to '' + +Default value: `$nfs::params::client_gssd_options` + +##### `client_d9_gssdopt_workaround` + +Data type: `Boolean` + +Boolean. If enabled, workaround for passing gssd_options which is broken on Debian 9. Usable only on Debian 9 + +Default value: `false` + +##### `nfs_v4_idmap_localrealms` + +Data type: `Variant[String, Array]` + +String or Array. 'Local-Realms' option for idmapd. Defaults to '' + +Default value: `''` + +##### `nfs_v4_idmap_cache` + +Data type: `Integer` + +Integer. 'Cache-Expiration' option for idmapd. Defaults to 0 - unused. + +Default value: `0` + +##### `manage_nfs_v4_idmap_nobody_mapping` + +Data type: `Boolean` + +Boolean. Enable setting Nobody mapping in idmapd. Defaults to false. + +Default value: `false` + +##### `nfs_v4_idmap_nobody_user` + +Data type: `String` + +String. 'Nobody-User' option for idmapd. Defaults to nobody. + +Default value: `$nfs::params::nfs_v4_idmap_nobody_user` + +##### `nfs_v4_idmap_nobody_group` + +Data type: `String` + +String. 'Nobody-Group' option for idmapd. Defaults to nobody or nogroup. + +Default value: `$nfs::params::nfs_v4_idmap_nobody_group` + +##### `client_rpcbind_config` + +Data type: `Optional[Stdlib::Absolutepath]` + +String. It defines the location of the file with the rpcbind config. + +Default value: `$nfs::params::client_rpcbind_config` + +##### `client_rpcbind_optname` + +Data type: `Optional[String]` + +String. It defines the name of env variable that holds the rpcbind config. E.g. OPTIONS for Debian + +Default value: `$nfs::params::client_rpcbind_optname` + +##### `client_rpcbind_opts` + +Data type: `Optional[String]` + +String. Options for rpcbind service. + +Default value: `undef` + +##### `nfs_v4_root_export_ensure` + +Data type: `String` + +String. It defines the state of the nfs version 4 root export. Defaults to mounted. + +Default value: `'mounted'` + +##### `nfs_v4_root_export_mount` + +Data type: `Optional[String]` + +String. It defines the mountpoint of the nfs version 4 root export. Defaults to undef. + +Default value: `undef` + +##### `nfs_v4_root_export_remounts` + +Data type: `Boolean` + +Boolean. It defines if the nfs version 4 root export should be remounted. Defaults to false. + +Default value: `false` + +##### `nfs_v4_root_export_atboot` + +Data type: `Boolean` + +Boolean. It defines if the nfs version 4 root export should be mounted at boot. Defaults to false. + +Default value: `false` + +##### `nfs_v4_root_export_options` + +Data type: `String` + +String. It defines the options for the nfs version 4 root export. Defaults to _netdev. + +Default value: `'_netdev'` + +##### `nfs_v4_root_export_bindmount` + +Data type: `Optional[String]` + +String. It defines the bindmount of the nfs version 4 root export. Defaults to undef. + +Default value: `undef` + +##### `nfs_v4_root_export_tag` + +Data type: `Optional[String]` + +String. It defines the tag of the nfs version 4 root export. Defaults to undef. + +Default value: `undef` + +##### `client_gssd_service_name` + +Data type: `Optional[Hash]` + +Hash. It defines the servicename of the rpc-gssd service. + +Default value: `$nfs::params::client_gssd_service_name` + +##### `client_services_hasrestart` + +Data type: `Boolean` + +Boolean. It defines the service parameter hasrestart for nfs client services. + +Default value: `$nfs::params::client_services_hasrestart` + +##### `client_services_hasstatus` + +Data type: `Boolean` + +Boolean. It defines the service parameter hasstatus for nfs client services. + +Default value: `$nfs::params::client_services_hasstatus` + +##### `client_gssdopt_name` + +Data type: `String` + +String. It defines the name of the gssd option in /etc/default/nfs-common. + +Default value: `$nfs::params::client_gssdopt_name` + +### `nfs::client` + +Class: nfs::client + +This class exists to + 1. order the loading of classes + 2. including all needed classes for nfs as a client + +* Daniel Klockenkaemper +* Martin Alfke + +#### Parameters + +The following parameters are available in the `nfs::client` class: + +* [`ensure`](#-nfs--client--ensure) +* [`nfs_v4`](#-nfs--client--nfs_v4) +* [`nfs_v4_mount_root`](#-nfs--client--nfs_v4_mount_root) +* [`nfs_v4_idmap_domain`](#-nfs--client--nfs_v4_idmap_domain) + +##### `ensure` + +Data type: `String` + +The ensure parameter is used to determine if the nfs client should be configured +and running or not. Valid values are 'present' and 'absent'. Default is 'present'. + +Default value: `$nfs::ensure` + +##### `nfs_v4` + +Data type: `String` + +The nfs_v4 parameter is used to determine if the nfs client should use nfs version 4. +Valid values are 'true' and 'false'. Default is 'false'. + +Default value: `$nfs::nfs_v4_client` + +##### `nfs_v4_mount_root` + +Data type: `String` + +The nfs_v4_mount_root parameter is used to determine the root directory for nfs version 4 mounts. +Default is '/mnt'. + +Default value: `$nfs::nfs_v4_mount_root` + +##### `nfs_v4_idmap_domain` + +Data type: `String` + +The nfs_v4_idmap_domain parameter is used to determine the domain for nfs version 4 id mapping. +Default is 'localdomain'. + +Default value: `$nfs::nfs_v4_idmap_domain` + +### `nfs::client::config` + +Class: nfs::client::config +This Function exists to + 1. configure nfs as a client + +* Daniel Klockenkaemper +* Martin Alfke + +### `nfs::client::package` + +Class: nfs::client::package + +This Function exists to + 1. install needed packages for nfs clients + +* Daniel Klockenkaemper +* Martin Alfke + +### `nfs::client::service` + +Class: nfs::client::service + +This Function exists to + 1. manage the needed services for nfs clients + +* Daniel Klockenkaemper +* Martin Alfke + +### `nfs::params` + +Class: nfs::params + +This class exists to +1. Declutter the default value assignment for class parameters. +2. Manage internally used module variables in a central place. + +Therefore, many operating system dependent differences (names, paths, ...) +are addressed in here. + +* Daniel Klockenkaemper +* Martin Alfke + +### `nfs::server` + +This class exists to + 1. order the loading of classes + 2. including all needed classes for nfs as a server + +* Daniel Klockenkaemper +* Martin Alfke + +#### Parameters + +The following parameters are available in the `nfs::server` class: + +* [`ensure`](#-nfs--server--ensure) +* [`nfs_v4`](#-nfs--server--nfs_v4) +* [`nfs_v4_export_root`](#-nfs--server--nfs_v4_export_root) +* [`nfs_v4_export_root_clients`](#-nfs--server--nfs_v4_export_root_clients) +* [`nfs_v4_idmap_domain`](#-nfs--server--nfs_v4_idmap_domain) +* [`nfs_v4_root_export_ensure`](#-nfs--server--nfs_v4_root_export_ensure) +* [`nfs_v4_root_export_mount`](#-nfs--server--nfs_v4_root_export_mount) +* [`nfs_v4_root_export_remounts`](#-nfs--server--nfs_v4_root_export_remounts) +* [`nfs_v4_root_export_atboot`](#-nfs--server--nfs_v4_root_export_atboot) +* [`nfs_v4_root_export_options`](#-nfs--server--nfs_v4_root_export_options) +* [`nfs_v4_root_export_bindmount`](#-nfs--server--nfs_v4_root_export_bindmount) +* [`nfs_v4_root_export_tag`](#-nfs--server--nfs_v4_root_export_tag) + +##### `ensure` + +Data type: `Enum['present', 'absent', 'running', 'stopped', 'disabled']` + + + +Default value: `$nfs::ensure` + +##### `nfs_v4` + +Data type: `Boolean` + + + +Default value: `$nfs::nfs_v4` + +##### `nfs_v4_export_root` + +Data type: `String` + + + +Default value: `$nfs::nfs_v4_export_root` + +##### `nfs_v4_export_root_clients` + +Data type: `String` + + + +Default value: `$nfs::nfs_v4_export_root_clients` + +##### `nfs_v4_idmap_domain` + +Data type: `String` + + + +Default value: `$nfs::nfs_v4_idmap_domain` + +##### `nfs_v4_root_export_ensure` + +Data type: `String` + + + +Default value: `$nfs::nfs_v4_root_export_ensure` + +##### `nfs_v4_root_export_mount` + +Data type: `Optional[String]` + + + +Default value: `$nfs::nfs_v4_root_export_mount` + +##### `nfs_v4_root_export_remounts` + +Data type: `Boolean` + + + +Default value: `$nfs::nfs_v4_root_export_remounts` + +##### `nfs_v4_root_export_atboot` + +Data type: `Boolean` + + + +Default value: `$nfs::nfs_v4_root_export_atboot` + +##### `nfs_v4_root_export_options` + +Data type: `String` + + + +Default value: `$nfs::nfs_v4_root_export_options` + +##### `nfs_v4_root_export_bindmount` + +Data type: `Optional[String]` + + + +Default value: `$nfs::nfs_v4_root_export_bindmount` + +##### `nfs_v4_root_export_tag` + +Data type: `Optional[String]` + + + +Default value: `$nfs::nfs_v4_root_export_tag` + +### `nfs::server::config` + +Class: nfs::server::config + +This class exists to + 1. configure nfs as a server + +* Daniel Klockenkaemper +* Martin Alfke + +### `nfs::server::package` + +Class: nfs::server::package + +This Function exists to + 1. install needed packages for nfs server + +* Daniel Klockenkaemper +* Martin Alfke + +### `nfs::server::service` + +Class: nfs::server::service + +This Function exists to + 1. manage the needed services for nfs server + +* Daniel Klockenkaemper +* Martin Alfke + +## Defined types + +### `nfs::client::mount` + +Function: nfs::client::mount + +This Function exists to + 1. manage all mounts on a nfs client + +Parameters + +param nfs_v4 + Boolean. When set to true, it uses nfs version 4 to mount a share. + +class { '::nfs': + client_enabled => true, + nfs_v4_client => true +} + +nfs::client::mount { '/target/directory': + server => '1.2.3.4', + share => 'share_name_on_nfs_server', + remounts => true, + atboot => true, + options_nfsv4 => 'tcp,nolock,rsize=32768,wsize=32768,intr,noatime,actimeo=3' +} + +* Daniel Klockenkaemper +* Martin Alfke + +#### Parameters + +The following parameters are available in the `nfs::client::mount` defined type: + +* [`server`](#-nfs--client--mount--server) +* [`share`](#-nfs--client--mount--share) +* [`ensure`](#-nfs--client--mount--ensure) +* [`remounts`](#-nfs--client--mount--remounts) +* [`atboot`](#-nfs--client--mount--atboot) +* [`options_nfsv4`](#-nfs--client--mount--options_nfsv4) +* [`options_nfs`](#-nfs--client--mount--options_nfs) +* [`bindmount`](#-nfs--client--mount--bindmount) +* [`nfstag`](#-nfs--client--mount--nfstag) +* [`owner`](#-nfs--client--mount--owner) +* [`group`](#-nfs--client--mount--group) +* [`mode`](#-nfs--client--mount--mode) +* [`mount_root`](#-nfs--client--mount--mount_root) +* [`mount`](#-nfs--client--mount--mount) +* [`manage_packages`](#-nfs--client--mount--manage_packages) +* [`client_packages`](#-nfs--client--mount--client_packages) +* [`nfs_v4`](#-nfs--client--mount--nfs_v4) + +##### `server` + +Data type: `String[1]` + +String. Sets the ip address of the server with the nfs export + +##### `share` + +Data type: `Optional[String[1]]` + +String. Sets the name of the nfs share on the server + +Default value: `undef` + +##### `ensure` + +Data type: `String[1]` + +String. Sets the ensure parameter of the mount. + +Default value: `'mounted'` + +##### `remounts` + +Data type: `Boolean` + +String. Sets the remounts parameter of the mount. + +Default value: `false` + +##### `atboot` + +Data type: `Boolean` + +String. Sets the atboot parameter of the mount. + +Default value: `false` + +##### `options_nfsv4` + +Data type: `String[1]` + +String. Sets the mount options for a nfs version 4 mount. + +Default value: `$nfs::client_nfsv4_options` + +##### `options_nfs` + +Data type: `String[1]` + +String. Sets the mount options for a nfs mount. + +Default value: `$nfs::client_nfs_options` + +##### `bindmount` + +Data type: `Optional[String[1]]` + +String. When not undef it will create a bindmount on the node +for the nfs mount. + +Default value: `undef` + +##### `nfstag` + +Data type: `Optional[String[1]]` + +String. Sets the nfstag parameter of the mount. + +Default value: `undef` + +##### `owner` + +Data type: `Optional[String[1]]` + +String. Set owner of mount dir + +Default value: `undef` + +##### `group` + +Data type: `Optional[String[1]]` + +String. Set group of mount dir + +Default value: `undef` + +##### `mode` + +Data type: `Optional[String[1]]` + +String. Set mode of mount dir + +Default value: `undef` + +##### `mount_root` + +Data type: `Optional[String[1]]` + +String. Overwrite mount root if differs from server config + +Default value: `undef` + +##### `mount` + +Data type: `String[1]` + + + +Default value: `$title` + +##### `manage_packages` + +Data type: `Boolean` + + + +Default value: `$nfs::manage_packages` + +##### `client_packages` + +Data type: `Optional[Variant[String[1], Array[String[1]]]]` + + + +Default value: `$nfs::effective_client_packages` + +##### `nfs_v4` + +Data type: `Boolean` + + + +Default value: `$nfs::client::nfs_v4` + +### `nfs::functions::bindmount` + +Function: nfs::functions::bindmount + +This Function exists to + 1. manage bindmounts + +* Daniel Klockenkaemper +* Martin Alfke + +#### Parameters + +The following parameters are available in the `nfs::functions::bindmount` defined type: + +* [`mount_name`](#-nfs--functions--bindmount--mount_name) +* [`ensure`](#-nfs--functions--bindmount--ensure) + +##### `mount_name` + +Data type: `Optional[String[1]]` + +String. Sets the target directory for the bindmount + +Default value: `undef` + +##### `ensure` + +Data type: `String[1]` + +String. Sets if enabled or not. + +Default value: `'present'` + +### `nfs::functions::create_export` + +Function: nfs::functions::create_export + +This Function exists to + 1. manage export creation + +* Daniel Klockenkaemper +* Martin Alfke + +#### Parameters + +The following parameters are available in the `nfs::functions::create_export` defined type: + +* [`clients`](#-nfs--functions--create_export--clients) +* [`ensure`](#-nfs--functions--create_export--ensure) +* [`owner`](#-nfs--functions--create_export--owner) +* [`group`](#-nfs--functions--create_export--group) +* [`mode`](#-nfs--functions--create_export--mode) + +##### `clients` + +Data type: `Variant[String[1], Array[String[1]]]` + +String or Array. Sets the clients allowed to mount the export with options. + +##### `ensure` + +Data type: `String[1]` + +String. Sets if enabled or not. + +Default value: `'present'` + +##### `owner` + +Data type: `Optional[String[1]]` + +String. Sets the owner of the exported directory. + +Default value: `undef` + +##### `group` + +Data type: `Optional[String[1]]` + +String. Sets the group of the exported directory. + +Default value: `undef` + +##### `mode` + +Data type: `Optional[String[1]]` + +String. Sets the permissions of the exported directory. + +Default value: `undef` + +### `nfs::functions::mkdir` + +Function: nfs::functions::mkdir + +This Function exists to + 1. manage dir creation + +* Daniel Klockenkaemper +* Martin Alfke + +#### Parameters + +The following parameters are available in the `nfs::functions::mkdir` defined type: + +* [`ensure`](#-nfs--functions--mkdir--ensure) + +##### `ensure` + +Data type: `String[1]` + + + +Default value: `'present'` + +### `nfs::functions::nfsv4_bindmount` + +Function: nfs::functions::nfsv4_bindmount + +This Function exists to + 1. manage bindmounts for nfs4 + +* Daniel Klockenkaemper +* Martin Alfke + +#### Parameters + +The following parameters are available in the `nfs::functions::nfsv4_bindmount` defined type: + +* [`v4_export_name`](#-nfs--functions--nfsv4_bindmount--v4_export_name) +* [`bind`](#-nfs--functions--nfsv4_bindmount--bind) +* [`ensure`](#-nfs--functions--nfsv4_bindmount--ensure) + +##### `v4_export_name` + +Data type: `String[1]` + +String. Sets the target directory for the bindmount + +##### `bind` + +Data type: `String[1]` + +String. Sets the bindmount options. + +##### `ensure` + +Data type: `String[1]` + +String. Sets if mounted or not. + +Default value: `'mounted'` + +### `nfs::server::export` + +Function: nfs::server::export + +This Function exists to + 1. manage all exported resources on a nfs server + +Parameters + +class { '::nfs': + server_enabled => true, + nfs_v4 => true, + nfs_v4_export_root => '/share', + nfs_v4_export_root_clients => '1.2.3.4/24(rw,fsid=root,insecure,no_subtree_check,async,no_root_squash)', +} + +nfs::server::export { '/srv/nfs_exported/directory': + clients => '1.2.3.4/24(rw,insecure,no_subtree_check,async,no_root_squash) 5.6.7.8/24(ro)', + share => 'share_name_on_nfs_server', +} + +Links + +* {Puppet Docs: Using Parameterized Classes}[http://j.mp/nVpyWY] + + +* Daniel Klockenkaemper +* Martin Alfke + +#### Parameters + +The following parameters are available in the `nfs::server::export` defined type: + +* [`clients`](#-nfs--server--export--clients) +* [`bind`](#-nfs--server--export--bind) +* [`ensure`](#-nfs--server--export--ensure) +* [`remounts`](#-nfs--server--export--remounts) +* [`atboot`](#-nfs--server--export--atboot) +* [`options_nfsv4`](#-nfs--server--export--options_nfsv4) +* [`options_nfs`](#-nfs--server--export--options_nfs) +* [`bindmount`](#-nfs--server--export--bindmount) +* [`nfstag`](#-nfs--server--export--nfstag) +* [`mount`](#-nfs--server--export--mount) +* [`owner`](#-nfs--server--export--owner) +* [`group`](#-nfs--server--export--group) +* [`mode`](#-nfs--server--export--mode) +* [`server`](#-nfs--server--export--server) +* [`v3_export_name`](#-nfs--server--export--v3_export_name) +* [`v4_export_name`](#-nfs--server--export--v4_export_name) +* [`nfsv4_bindmount_enable`](#-nfs--server--export--nfsv4_bindmount_enable) + +##### `clients` + +Data type: `String[1]` + +String or Array. Sets the allowed clients and options for the export in the exports file. +Defaults to localhost(ro) + +Default value: `'localhost(ro)'` + +##### `bind` + +Data type: `String[1]` + +String. Sets the bind options setted in /etc/fstab for the bindmounts created. +Defaults to rbind + +Default value: `'rbind'` + +##### `ensure` + +Data type: `String[1]` + +String. If enabled the mount will be created. Defaults to mounted + +Default value: `'mounted'` + +##### `remounts` + +Data type: `Boolean` + +String. Sets the remounts parameter of the mount. + +Default value: `false` + +##### `atboot` + +Data type: `Boolean` + +String. Sets the atboot parameter of the mount. + +Default value: `false` + +##### `options_nfsv4` + +Data type: `String[1]` + +String. Sets the mount options for a nfs version 4 exported resource mount. + +Default value: `$nfs::client_nfsv4_options` + +##### `options_nfs` + +Data type: `String[1]` + +String. Sets the mount options for a nfs exported resource mount. + +Default value: `$nfs::client_nfs_options` + +##### `bindmount` + +Data type: `Optional[String[1]]` + +String. When not undef it will create a bindmount on the node +for the nfs mount. + +Default value: `undef` + +##### `nfstag` + +Data type: `Optional[String[1]]` + +String. Sets the nfstag parameter of the mount. + +Default value: `undef` + +##### `mount` + +Data type: `Optional[String[1]]` + +String. Sets the mountpoint the client will mount the exported resource mount on. If undef +it defaults to the same path as on the server + +Default value: `undef` + +##### `owner` + +Data type: `Optional[String[1]]` + +String. Sets the owner of the exported directory + +Default value: `undef` + +##### `group` + +Data type: `Optional[String[1]]` + +String. Sets the group of the exported directory + +Default value: `undef` + +##### `mode` + +Data type: `Optional[String[1]]` + +String. Sets the permissions of the exported directory. + +Default value: `undef` + +##### `server` + +Data type: `String[1]` + +String. Sets the hostname clients will use to mount the exported resource. If undef it +defaults to the trusted certname + +Default value: `$facts['clientcert']` + +##### `v3_export_name` + +Data type: `String[1]` + + + +Default value: `$name` + +##### `v4_export_name` + +Data type: `String[1]` + + + +Default value: `regsubst($name, '.*/(.*)', '\1' )` + +##### `nfsv4_bindmount_enable` + +Data type: `Boolean` + + + +Default value: `$nfs::nfsv4_bindmount_enable` + diff --git a/manifests/client.pp b/manifests/client.pp index b49a4b8b..d74e0c30 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -17,7 +17,7 @@ # @param nfs_v4_idmap_domain # The nfs_v4_idmap_domain parameter is used to determine the domain for nfs version 4 id mapping. # Default is 'localdomain'. -# @authors +# @author # * Daniel Klockenkaemper # * Martin Alfke # diff --git a/manifests/client/config.pp b/manifests/client/config.pp index 94ad2fea..d9e4c52c 100644 --- a/manifests/client/config.pp +++ b/manifests/client/config.pp @@ -3,7 +3,7 @@ # This Function exists to # 1. configure nfs as a client # -# @authors +# @author # * Daniel Klockenkaemper # * Martin Alfke # diff --git a/manifests/client/mount.pp b/manifests/client/mount.pp index 8f4142e0..043ccc5e 100644 --- a/manifests/client/mount.pp +++ b/manifests/client/mount.pp @@ -54,7 +54,7 @@ # @param client_packages # @param nfs_v4 # -# @examples +# @example # # class { '::nfs': # client_enabled => true, @@ -69,7 +69,7 @@ # options_nfsv4 => 'tcp,nolock,rsize=32768,wsize=32768,intr,noatime,actimeo=3' # } # -# @authors +# @author # * Daniel Klockenkaemper # * Martin Alfke # diff --git a/manifests/client/package.pp b/manifests/client/package.pp index 5b6aa44b..5b731568 100644 --- a/manifests/client/package.pp +++ b/manifests/client/package.pp @@ -4,7 +4,7 @@ # This Function exists to # 1. install needed packages for nfs clients # -# @authors +# @author # * Daniel Klockenkaemper # * Martin Alfke # diff --git a/manifests/client/service.pp b/manifests/client/service.pp index 613684f9..5531c654 100644 --- a/manifests/client/service.pp +++ b/manifests/client/service.pp @@ -4,7 +4,7 @@ # This Function exists to # 1. manage the needed services for nfs clients # -# @authors +# @author # * Daniel Klockenkaemper # * Martin Alfke # diff --git a/manifests/functions/bindmount.pp b/manifests/functions/bindmount.pp index 455aa3b1..faf1abec 100644 --- a/manifests/functions/bindmount.pp +++ b/manifests/functions/bindmount.pp @@ -10,7 +10,7 @@ # @param ensure # String. Sets if enabled or not. # -# @authors +# @author # * Daniel Klockenkaemper # * Martin Alfke # diff --git a/manifests/functions/create_export.pp b/manifests/functions/create_export.pp index ff74b26c..b6101353 100644 --- a/manifests/functions/create_export.pp +++ b/manifests/functions/create_export.pp @@ -19,7 +19,7 @@ # @param mode # String. Sets the permissions of the exported directory. # -# @authors +# @author # * Daniel Klockenkaemper # * Martin Alfke # diff --git a/manifests/functions/mkdir.pp b/manifests/functions/mkdir.pp index fe0a6a67..97dd0a8b 100644 --- a/manifests/functions/mkdir.pp +++ b/manifests/functions/mkdir.pp @@ -6,7 +6,7 @@ # # @param ensure # -# @authors +# @author # * Daniel Klockenkaemper # * Martin Alfke # diff --git a/manifests/functions/nfsv4_bindmount.pp b/manifests/functions/nfsv4_bindmount.pp index 0934d2fe..6435f288 100644 --- a/manifests/functions/nfsv4_bindmount.pp +++ b/manifests/functions/nfsv4_bindmount.pp @@ -13,11 +13,10 @@ # @param ensure # String. Sets if mounted or not. # -# === Authors -# +# @author # * Daniel Klockenkaemper +# * Martin Alfke # - define nfs::functions::nfsv4_bindmount ( String[1] $v4_export_name, String[1] $bind, diff --git a/manifests/init.pp b/manifests/init.pp index b0e50746..55f61afd 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -157,10 +157,10 @@ # Boolean. It defines the service parameter hasstatus for nfs client services. # @param client_gssdopt_name # String. It defines the name of the gssd option in /etc/default/nfs-common. -# @examples +# @example # * {Please take a look at} [https://github.com/voxpupuli/puppet-nfs#examples] # -# @authors +# @author # * Daniel Klockenkaemper # * Martin Alfke # diff --git a/manifests/params.pp b/manifests/params.pp index 4ba905f0..416e0c7f 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -8,7 +8,7 @@ # Therefore, many operating system dependent differences (names, paths, ...) # are addressed in here. # -# @authors +# @author # * Daniel Klockenkaemper # * Martin Alfke # diff --git a/manifests/server.pp b/manifests/server.pp index 29517f42..7b337936 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -1,13 +1,8 @@ # @summary Class: nfs::server -# # This class exists to # 1. order the loading of classes # 2. including all needed classes for nfs as a server # -# Links -# -# * {Puppet Docs: Using Parameterized Classes}[http://j.mp/nVpyWY] -# # @param ensure # @param nfs_v4 # @param nfs_v4_export_root @@ -21,7 +16,7 @@ # @param nfs_v4_root_export_bindmount # @param nfs_v4_root_export_tag # -# @authors +# @author # * Daniel Klockenkaemper # * Martin Alfke # diff --git a/manifests/server/config.pp b/manifests/server/config.pp index cc2c2dea..989958a8 100644 --- a/manifests/server/config.pp +++ b/manifests/server/config.pp @@ -1,19 +1,13 @@ -# == Class: nfs::server::config +# Class: nfs::server::config # +# @summary # This class exists to # 1. configure nfs as a server # -# -# === Links -# -# * {Puppet Docs: Using Parameterized Classes}[http://j.mp/nVpyWY] -# -# -# === Authors -# +# @author # * Daniel Klockenkaemper +# * Martin Alfke # - class nfs::server::config { concat { $nfs::exports_file: ensure => present, diff --git a/manifests/server/export.pp b/manifests/server/export.pp index 7e559d61..3b5a26bf 100644 --- a/manifests/server/export.pp +++ b/manifests/server/export.pp @@ -76,7 +76,7 @@ # * {Puppet Docs: Using Parameterized Classes}[http://j.mp/nVpyWY] # # -# @authors +# @author # # * Daniel Klockenkaemper # * Martin Alfke diff --git a/manifests/server/package.pp b/manifests/server/package.pp index 19e1290d..3ee9128c 100644 --- a/manifests/server/package.pp +++ b/manifests/server/package.pp @@ -1,19 +1,13 @@ -# == Class: nfs::server::package +# Class: nfs::server::package # +# @summary # This Function exists to # 1. install needed packages for nfs server # -# -# === Links -# -# * {Puppet Docs: Using Parameterized Classes}[http://j.mp/nVpyWY] -# -# -# === Authors -# +# @author # * Daniel Klockenkaemper +# * Martin Alfke # - class nfs::server::package { if $nfs::manage_packages { if $nfs::manage_server_service { diff --git a/manifests/server/service.pp b/manifests/server/service.pp index 3bc44009..7360d768 100644 --- a/manifests/server/service.pp +++ b/manifests/server/service.pp @@ -1,19 +1,13 @@ -# == Class: nfs::server::service +# Class: nfs::server::service # +# @summary # This Function exists to # 1. manage the needed services for nfs server # -# -# === Links -# -# * {Puppet Docs: Using Parameterized Classes}[http://j.mp/nVpyWY] -# -# -# === Authors -# +# @author # * Daniel Klockenkaemper +# * Martin Alfke # - class nfs::server::service { if $nfs::nfs_v4 == true { if $nfs::server_nfsv4_servicehelper != undef and $nfs::manage_server_servicehelper { From 160f6e512b7d45f960ed127c0b5810c9a8ac337c Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Mon, 3 Jun 2024 14:57:29 +0200 Subject: [PATCH 07/30] MD fixes --- CHANGELOG.md | 8 ++++---- README.md | 52 ++++++++++++++++++++++++++-------------------------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d38f9ba..d938b5d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,14 +49,14 @@ - ignore export root when bindmount is disabled - use BEAKER_PUPPET_COLLECTION in all beaker tests - do not include class by absolute name -- revert use of File without defined() +- revert use of File without defined() - update rvm to 2.4.1 for PUPPET_VERSION 4.10.0 ## 2019-02-12 - Release 2.1.2 ### Summary #### Features -- herculesteam-augeasprovides_shellvar has been updated to 3.0.0 +- herculesteam-augeasprovides_shellvar has been updated to 3.0.0 ## 2019-02-12 - Release 2.1.1 ### Summary @@ -130,7 +130,7 @@ - set $nfs_v4_idmap_domain to 'example.org' when $::domain is undef - add client service rpcbind.socket for RedHat 7 - set client service rpcbind.service for RedHat 7 to enable => false -- fix service parameters for Debian 7 +- fix service parameters for Debian 7 #### Features - update rubocop rules and fix ruby code style @@ -149,7 +149,7 @@ - add install locales on ubuntu-1604 docker for acceptance tests - add missing documentation for client_services_enable - reenable client_services_enable for CentOS/Redhat 7 -- remove rpc.idmapd from $client_nfsv4_services for Archlinux +- remove rpc.idmapd from $client_nfsv4_services for Archlinux - rename rpc.idmapd to nfs-idmapd in $server_nfsv4_servicehelper for archlinux - update adn fix spec tests diff --git a/README.md b/README.md index 8ee4b42a..0ab7d836 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,10 @@ #### Table of Contents 1. [Module Description - What the module does and why it is useful](#module-description) -2. [Setup - The basics of getting started with derdanne-nfs](#setup) - * [What derdanne-nfs affects](#what-derdanne-nfs-affects) +2. [Setup - The basics of getting started with puppet-nfs](#setup) + * [What puppet-nfs affects](#what-puppet-nfs-affects) * [Setup requirements](#setup-requirements) - * [Beginning with derdanne-nfs](#beginning-with-derdanne-nfs) + * [Beginning with puppet-nfs](#beginning-with-puppet-nfs) 3. [Usage - Configuration options and additional functionality](#usage) 4. [Reference - An under-the-hood peek at what the module is doing and how](#reference) 5. [Limitations - OS compatibility, etc.](#limitations) @@ -24,10 +24,10 @@ and 'client_enabled'. It also has some dependencies on newer stdlib functions li It supports the OS Families Ubuntu, Debian, Redhat, SUSE, Gentoo and Archlinux. It supports also Strict Variables, so if you pass all OS specific parameters correctly it should work on your preferred OS too. Feedback, bugreports, -and feature requests are always welcome, visit https://github.com/derdanne/puppet-nfs or send me an email. +and feature requests are always welcome, visit https://github.com/voxpupuli/puppet-nfs or send me an email. -When you are using a puppet version 3.x like it is shipped with Redhat Satellite 6, please use a version 1.x.x from puppet forge -or the branch puppet3 when cloning directly from Github. (Note: https://github.com/derdanne/puppet-nfs/pull/49#issuecomment-285091678). +When you are using a puppet version 3.x like it is shipped with Redhat Satellite 6, please use a version 1.x.x from puppet forge +or the branch puppet3 when cloning directly from Github. (Note: https://github.com/voxpupuli/puppet-nfs/pull/49#issuecomment-285091678). I'll recommend using puppet >= 4.6.1, puppet versions up until 4.6.0 had various issues. If you want to contribute, please do a fork on github, create a branch "feature name" with your @@ -40,18 +40,18 @@ Warning: I've introduced new dependencies with version 2.1.0 which were needed t ## Setup -### What derdanne-nfs affects +### What puppet-nfs affects -This module can be used to configure your nfs client and/or server, it could export -nfs mount resources via storeconfigs or simply mount nfs shares on a client. You can +This module can be used to configure your nfs client and/or server, it could export +nfs mount resources via storeconfigs or simply mount nfs shares on a client. You can also easily use the create_resources function when you store your exports i.e. via hiera. ### Setup requirements This Module depends on puppetlabs-stdlib >= 4.5.0 and puppetlabs-concat >= 1.1.2, you need to -have these modules installed to use derdanne-nfs module. +have these modules installed to use puppet-nfs module. -### Beginning with derdanne-nfs +### Beginning with puppet-nfs On a nfs server the following code is sufficient to get all packages installed and services running to use nfs: @@ -110,7 +110,7 @@ This will mount /data on client in /share/data. nfs_v4_client => true, nfs_v4_idmap_domain => $::domain, } - + nfs::client::mount { '/share/data': server => '192.168.0.1', share => 'data', @@ -368,26 +368,26 @@ This will mount /data on client in /share/data. **Puppet:** ```puppet - + node server { hiera_include('classes') $nfs_exports_global = hiera_hash('nfs::nfs_exports_global', false) - + $defaults_nfs_exports = { ensure => 'mounted', clients => '192.168.0.0/24(rw,insecure,no_subtree_check,async,no_root_squash)', nfstag => $::fqdn, } - + if $nfs_exports_global { create_resources('::nfs::server::export', $nfs_exports_global, $defaults_nfs_exports) } } - + node client { hiera_include('classes') $nfs_server = hiera('nfs::nfs_server', false) - + if $nfs_server { Nfs::Client::Mount <<| nfstag == $nfs_server |>> } @@ -611,7 +611,7 @@ This will mount /data on client in /share/data. String. 'Nobody-User' option for idmapd. Defaults to nobody. ##### `nfs_v4_idmap_nobody_group` - String. 'Nobody-Group' option for idmapd. Defaults to nobody or nogroup. + String. 'Nobody-Group' option for idmapd. Defaults to nobody or nogroup. ##### `client_rpcbind_config` String. It defines the location of the file with the rpcbind config. @@ -681,10 +681,10 @@ This will mount /data on client in /share/data. ##### `bind` String. Sets the bind options setted in /etc/fstab for the bindmounts created. Defaults to rbind. When you have any submounts in your exported folders, - the rbind option will submount them in the bindmount folder. You have to set the + the rbind option will submount them in the bindmount folder. You have to set the  `crossmnt` option in your nfs export to have the submounts from rbind available on your client. Your export should look like this: - + ```puppet node client { nfs::server::export { '/home': @@ -692,7 +692,7 @@ node client { clients => '*(rw,insecure,no_subtree_check,async,no_root_squash,crossmnt)', } } -``` +``` ##### `ensure` String. If enabled the mount will be created. Defaults to mounted @@ -746,19 +746,19 @@ puppet > 3.2.0 augeas ## Limitations -If you want to have specific package versions installed you may manage the needed packages outside of this +If you want to have specific package versions installed you may manage the needed packages outside of this module (use manage_packages => false). It is only tested to use 'present', 'installed', 'absent', 'purged', 'held' and 'latest' as argument for the parameters server_package_ensure and client_package_ensure. ## Development Derdanne modules are open projects. So if you want to make this module even better, -you can contribute to this module on [Github](https://github.com/derdanne/puppet-nfs). +you can contribute to this module on [Github](https://github.com/voxpupuli/puppet-nfs). Before pushing PRs to Github i would recommend you to test your work locally. So you can ensure all test builds -on Travis CI were passing. I have prepared an easy way to test your code locally with the help of Docker. +on Travis CI were passing. I have prepared an easy way to test your code locally with the help of Docker. -For running the complete static code analysis, it is sufficient to run a `make test-all`. +For running the complete static code analysis, it is sufficient to run a `make test-all`. ### Default settings @@ -790,7 +790,7 @@ You can run the following commands to setup and run the testsuite on your local #### `make build` -Build a docker image with a Ruby version which is not available on Docker hub. Check out +Build a docker image with a Ruby version which is not available on Docker hub. Check out `https://hub.docker.com/r/derdanne/rvm/` to see if i have already prepared a rvm build for the ruby version you want to test. Take a look at the Dockerfile located in `spec/local-testing` if you want to customize your builds. From 4c1733acf0a1efbb9b4ea63f908419f714a48ef9 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Mon, 3 Jun 2024 15:14:49 +0200 Subject: [PATCH 08/30] refactor spec tests --- .fixtures.yml | 6 +- manifests/client.pp | 2 +- metadata.json | 27 ++--- spec/classes/nfs_spec.rb | 256 ++++----------------------------------- 4 files changed, 36 insertions(+), 255 deletions(-) diff --git a/.fixtures.yml b/.fixtures.yml index 75366ce4..a18692c3 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -4,10 +4,8 @@ fixtures: concat: "https://github.com/puppetlabs/puppetlabs-concat.git" augeasproviders_core: "https://github.com/voxpupuli/puppet-augeasproviders_core.git" augeasproviders_shellvar: "https://github.com/voxpupuli/puppet-augeasproviders_shellvar.git" - augeas_core: - repo: "https://github.com/puppetlabs/puppetlabs-augeas_core.git" - mount_core: - repo: "https://github.com/puppetlabs/puppetlabs-mount_core.git" + augeas_core: "https://github.com/puppetlabs/puppetlabs-augeas_core.git" + mount_core: "https://github.com/puppetlabs/puppetlabs-mount_core.git" transition: "https://github.com/puppetlabs/puppetlabs-transition.git" symlinks: "nfs": "#{source_dir}" diff --git a/manifests/client.pp b/manifests/client.pp index d74e0c30..18dfdb6e 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -23,7 +23,7 @@ # class nfs::client ( String $ensure = $nfs::ensure, - String $nfs_v4 = $nfs::nfs_v4_client, + Boolean $nfs_v4 = $nfs::nfs_v4_client, String $nfs_v4_mount_root = $nfs::nfs_v4_mount_root, String $nfs_v4_idmap_domain = $nfs::nfs_v4_idmap_domain, ) { diff --git a/metadata.json b/metadata.json index 721792fd..4886b296 100644 --- a/metadata.json +++ b/metadata.json @@ -1,12 +1,12 @@ { - "name": "derdanne-nfs", + "name": "puppet-nfs", "version": "2.1.11", - "source": "https://github.com/derdanne/puppet-nfs.git", + "source": "https://github.com/voxpupuli/puppet-nfs.git", "author": "derdanne", "license": "Apache-2.0", "summary": "Installs and configures NFS server and clients", - "project_page": "https://github.com/derdanne/puppet-nfs", - "issues_url": "https://github.com/derdanne/puppet-nfs/issues", + "project_page": "https://github.com/voxpupuli/puppet-nfs", + "issues_url": "https://github.com/voxpupuli/puppet-nfs/issues", "dependencies": [ {"name":"puppetlabs/stdlib","version_requirement":">= 4.5.0 < 9.0.0"}, {"name":"puppetlabs/concat","version_requirement":">= 1.1.2 < 8.0.0"}, @@ -19,9 +19,6 @@ { "operatingsystem": "Ubuntu", "operatingsystemrelease": [ - "14.04", - "16.04", - "18.04", "20.04", "22.04" ] @@ -29,19 +26,16 @@ { "operatingsystem": "Debian", "operatingsystemrelease": [ - "6", - "7", - "8", - "9", - "10", - "11" + "11", + "12" ] }, { "operatingsystem": "RedHat", "operatingsystemrelease": [ "7", - "8" + "8", + "9" ] }, { @@ -53,7 +47,8 @@ { "operatingsystem": "SLES", "operatingsystemrelease": [ - "12" + "12", + "15" ] }, { @@ -72,7 +67,7 @@ "requirements": [ { "name": "puppet", - "version_requirement": ">= 4.0.0 < 9.0.0" + "version_requirement": ">= 7.0.0 < 9.0.0" } ] } diff --git a/spec/classes/nfs_spec.rb b/spec/classes/nfs_spec.rb index 586963f4..73023c0a 100644 --- a/spec/classes/nfs_spec.rb +++ b/spec/classes/nfs_spec.rb @@ -3,10 +3,11 @@ require 'spec_helper' describe 'nfs' do - # supported_os = %w[Ubuntu_default Ubuntu_16.04 Debian_default Debian_8 RedHat_default RedHat_7 RedHat_75 RedHat_8 Gentoo SLES Archlinux] - supported_os = %w[Ubuntu_16.04 Ubuntu_18.04 Ubuntu_20.04 Ubuntu_22.04 Debian_8 Debian_9 Debian_10 Debian_11 RedHat_default RedHat_7 RedHat_75 RedHat_8 Gentoo SLES] - supported_os.each do |os| - context os do + on_supported_os.each do |os, facts| + context "on #{os}" do + let(:facts) do + facts + end let(:default_facts) do { 'concat_basedir' => '/tmp', @@ -23,20 +24,7 @@ when 'Ubuntu_default' let(:facts) do - default_facts.merge( - 'operatingsystem' => 'Ubuntu', - 'os' => { - 'family' => 'Debian', - 'distro' => { - 'codename' => 'trusty' - }, - 'release' => { - 'major' => '14', - 'minor' => '04', - 'full' => '14.04' - } - } - ) + default_facts.merge(facts) end server_service = 'nfs-kernel-server' @@ -54,20 +42,7 @@ when 'Ubuntu_16.04' let(:facts) do - default_facts.merge( - 'operatingsystem' => 'Ubuntu', - 'os' => { - 'family' => 'Debian', - 'distro' => { - 'codename' => 'xenial' - }, - 'release' => { - 'major' => '16', - 'minor' => '04', - 'full' => '16.04' - } - } - ) + default_facts.merge(facts) end server_service = 'nfs-kernel-server' @@ -85,20 +60,7 @@ when 'Ubuntu_18.04' let(:facts) do - default_facts.merge( - 'operatingsystem' => 'Ubuntu', - 'os' => { - 'family' => 'Debian', - 'distro' => { - 'codename' => 'bionic' - }, - 'release' => { - 'major' => '18', - 'minor' => '04', - 'full' => '18.04' - } - } - ) + default_facts.merge(facts) end server_service = 'nfs-kernel-server' @@ -116,20 +78,7 @@ when 'Ubuntu_20.04' let(:facts) do - default_facts.merge( - 'operatingsystem' => 'Ubuntu', - 'os' => { - 'family' => 'Debian', - 'distro' => { - 'codename' => 'focal' - }, - 'release' => { - 'major' => '20', - 'minor' => '04', - 'full' => '20.04' - } - } - ) + default_facts.merge(facts) end server_service = 'nfs-kernel-server' @@ -147,20 +96,7 @@ when 'Ubuntu_22.04' let(:facts) do - default_facts.merge( - 'operatingsystem' => 'Ubuntu', - 'os' => { - 'family' => 'Debian', - 'distro' => { - 'codename' => 'focal' - }, - 'release' => { - 'major' => '20', - 'minor' => '04', - 'full' => '20.04' - } - } - ) + default_facts.merge(facts) end server_service = 'nfs-kernel-server' @@ -178,19 +114,7 @@ when 'Debian_default' let(:facts) do - default_facts.merge( - 'operatingsystem' => 'Debian', - 'os' => { - 'family' => 'Debian', - 'distro' => { - 'codename' => 'wheezy' - }, - 'release' => { - 'major' => '7', - 'full' => '7' - } - } - ) + default_facts.merge(facts) end server_service = 'nfs-kernel-server' @@ -208,19 +132,7 @@ when 'Debian_8' let(:facts) do - default_facts.merge( - 'operatingsystem' => 'Debian', - 'os' => { - 'family' => 'Debian', - 'distro' => { - 'codename' => 'jessie' - }, - 'release' => { - 'major' => '8', - 'full' => '8' - } - } - ) + default_facts.merge(facts) end server_service = 'nfs-kernel-server' @@ -238,19 +150,7 @@ when 'Debian_9' let(:facts) do - default_facts.merge( - 'operatingsystem' => 'Debian', - 'os' => { - 'family' => 'Debian', - 'distro' => { - 'codename' => 'stretch' - }, - 'release' => { - 'major' => '9', - 'full' => '9' - } - } - ) + default_facts.merge(facts) end server_service = 'nfs-kernel-server' @@ -268,19 +168,7 @@ when 'Debian_10' let(:facts) do - default_facts.merge( - 'operatingsystem' => 'Debian', - 'os' => { - 'family' => 'Debian', - 'distro' => { - 'codename' => 'buster' - }, - 'release' => { - 'major' => '10', - 'full' => '10' - } - } - ) + default_facts.merge(facts) end server_service = 'nfs-kernel-server' @@ -298,19 +186,7 @@ when 'Debian_11' let(:facts) do - default_facts.merge( - 'operatingsystem' => 'Debian', - 'os' => { - 'family' => 'Debian', - 'distro' => { - 'codename' => 'bullseye' - }, - 'release' => { - 'major' => '11', - 'full' => '11' - } - } - ) + default_facts.merge(facts) end server_service = 'nfs-kernel-server' @@ -328,19 +204,7 @@ when 'RedHat_default' let(:facts) do - default_facts.merge( - 'operatingsystem' => 'RedHat', - 'os' => { - 'family' => 'RedHat', - 'distro' => { - 'codename' => 'RedHat 6' - }, - 'release' => { - 'major' => '6', - 'full' => '6' - } - } - ) + default_facts.merge(facts) end server_service = 'nfs' @@ -358,20 +222,7 @@ when 'RedHat_7' let(:facts) do - default_facts.merge( - 'operatingsystem' => 'RedHat', - 'os' => { - 'family' => 'RedHat', - 'distro' => { - 'codename' => 'RedHat 7.4' - }, - 'release' => { - 'major' => '7', - 'minor' => '4', - 'full' => '7.4' - } - } - ) + default_facts.merge(facts) end server_service = 'nfs-server.service' @@ -389,20 +240,7 @@ when 'RedHat_75' let(:facts) do - default_facts.merge( - 'operatingsystem' => 'RedHat', - 'os' => { - 'family' => 'RedHat', - 'distro' => { - 'codename' => 'RedHat 7.5' - }, - 'release' => { - 'major' => '7', - 'minor' => '5', - 'full' => '7.5' - } - } - ) + default_facts.merge(facts) end server_service = 'nfs-server.service' @@ -420,20 +258,7 @@ when 'RedHat_8' let(:facts) do - default_facts.merge( - 'operatingsystem' => 'RedHat', - 'os' => { - 'family' => 'RedHat', - 'distro' => { - 'codename' => 'RedHat 8' - }, - 'release' => { - 'major' => '8', - 'minor' => '0', - 'full' => '8.0' - } - } - ) + default_facts.merge(facts) end server_service = 'nfs-server.service' @@ -451,20 +276,7 @@ when 'Gentoo' let(:facts) do - default_facts.merge( - 'operatingsystem' => 'Gentoo', - 'os' => { - 'family' => 'Gentoo', - 'distro' => { - 'codename' => 'Gentoo' - }, - 'release' => { - 'major' => '1', - 'minor' => '0', - 'full' => '1.0' - } - } - ) + default_facts.merge(facts) end server_service = 'nfs' @@ -480,19 +292,7 @@ when 'SLES' let(:facts) do - default_facts.merge( - 'operatingsystem' => 'SLES', - 'os' => { - 'family' => 'Suse', - 'distro' => { - 'codename' => 'SLES' - }, - 'release' => { - 'major' => '12', - 'full' => '12' - } - } - ) + default_facts.merge(facts) end server_service = 'nfsserver' @@ -509,19 +309,7 @@ when 'Archlinux' let(:facts) do - default_facts.merge( - 'operatingsystem' => 'Archlinux', - 'os' => { - 'family' => 'Archlinux', - 'distro' => { - 'codename' => 'Archlinux' - }, - 'release' => { - 'major' => '3', - 'full' => '3' - } - } - ) + default_facts.merge(facts) end server_service = 'nfs-server.service' From ff1f4b965b742fda7b38da5704ce51f1a18d5c72 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Mon, 3 Jun 2024 15:15:57 +0200 Subject: [PATCH 09/30] update REFERENCE --- REFERENCE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/REFERENCE.md b/REFERENCE.md index 72c292dc..ad547db0 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -650,7 +650,7 @@ Default value: `$nfs::ensure` ##### `nfs_v4` -Data type: `String` +Data type: `Boolean` The nfs_v4 parameter is used to determine if the nfs client should use nfs version 4. Valid values are 'true' and 'false'. Default is 'false'. From 875241b012bdc6940fc50ad17f5100e4fc66d13d Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Mon, 3 Jun 2024 15:30:24 +0200 Subject: [PATCH 10/30] use on_supported_os instead of self assigen os names --- spec/classes/nfs_spec.rb | 215 +++------------------------------------ 1 file changed, 15 insertions(+), 200 deletions(-) diff --git a/spec/classes/nfs_spec.rb b/spec/classes/nfs_spec.rb index 73023c0a..97f57654 100644 --- a/spec/classes/nfs_spec.rb +++ b/spec/classes/nfs_spec.rb @@ -19,9 +19,18 @@ end ### vv switch case to set OS specific values vv ### + ## debian-12-x86_64 + ## ubuntu-20.04-x86_64 + ## redhat-9-x86_64 + ## redhat-8-x86_64 + ## sles-12-x86_64 + ## sles-15-x86_64 + ## debian-11-x86_64 + ## ubuntu-22.04-x86_64 + ## redhat-7-x86_64 case os - when 'Ubuntu_default' + when 'ubuntu-22.04-x86_64', 'ubuntu-20.04-x86_64' let(:facts) do default_facts.merge(facts) @@ -39,79 +48,7 @@ client_rpcbind_config = '/etc/default/rpcbind' client_rpcbind_optname = 'OPTIONS' - when 'Ubuntu_16.04' - - let(:facts) do - default_facts.merge(facts) - end - - server_service = 'nfs-kernel-server' - server_servicehelpers = %w[nfs-idmapd] - server_packages = %w[nfs-common nfs-kernel-server nfs4-acl-tools rpcbind] - client_services = %w[rpcbind] - client_nfs_vfour_services = %w[rpcbind] - client_packages = %w[nfs-common nfs4-acl-tools] - client_gssdopt_name = 'GSSDARGS' - defaults_file = '/etc/default/nfs-common' - idmapd_file = '/etc/idmapd.conf' - client_rpcbind_config = '/etc/default/rpcbind' - client_rpcbind_optname = 'OPTIONS' - - when 'Ubuntu_18.04' - - let(:facts) do - default_facts.merge(facts) - end - - server_service = 'nfs-kernel-server' - server_servicehelpers = '' - server_packages = %w[nfs-common nfs-kernel-server nfs4-acl-tools rpcbind] - client_services = %w[rpcbind] - client_nfs_vfour_services = %w[rpcbind] - client_packages = %w[nfs-common nfs4-acl-tools] - client_gssdopt_name = 'GSSDARGS' - defaults_file = '/etc/default/nfs-common' - idmapd_file = '/etc/idmapd.conf' - client_rpcbind_config = '/etc/default/rpcbind' - client_rpcbind_optname = 'OPTIONS' - - when 'Ubuntu_20.04' - - let(:facts) do - default_facts.merge(facts) - end - - server_service = 'nfs-kernel-server' - server_servicehelpers = '' - server_packages = %w[nfs-common nfs-kernel-server nfs4-acl-tools rpcbind] - client_services = %w[rpcbind] - client_nfs_vfour_services = %w[rpcbind] - client_packages = %w[nfs-common nfs4-acl-tools] - client_gssdopt_name = 'GSSDARGS' - defaults_file = '/etc/default/nfs-common' - idmapd_file = '/etc/idmapd.conf' - client_rpcbind_config = '/etc/default/rpcbind' - client_rpcbind_optname = 'OPTIONS' - - when 'Ubuntu_22.04' - - let(:facts) do - default_facts.merge(facts) - end - - server_service = 'nfs-kernel-server' - server_servicehelpers = '' - server_packages = %w[nfs-common nfs-kernel-server nfs4-acl-tools rpcbind] - client_services = %w[rpcbind] - client_nfs_vfour_services = %w[rpcbind] - client_packages = %w[nfs-common nfs4-acl-tools] - client_gssdopt_name = 'GSSDARGS' - defaults_file = '/etc/default/nfs-common' - idmapd_file = '/etc/idmapd.conf' - client_rpcbind_config = '/etc/default/rpcbind' - client_rpcbind_optname = 'OPTIONS' - - when 'Debian_default' + when 'debian-11-x86_64', 'debian-12-x86_64' let(:facts) do default_facts.merge(facts) @@ -129,79 +66,8 @@ client_rpcbind_config = '/etc/default/rpcbind' client_rpcbind_optname = 'OPTIONS' - when 'Debian_8' - - let(:facts) do - default_facts.merge(facts) - end - - server_service = 'nfs-kernel-server' - server_servicehelpers = %w[nfs-common] - server_packages = %w[nfs-common nfs-kernel-server nfs4-acl-tools rpcbind] - client_services = %w[rpcbind] - client_nfs_vfour_services = %w[rpcbind nfs-common] - client_packages = %w[nfs-common nfs4-acl-tools] - client_gssdopt_name = 'RPCGSSDOPTS' - defaults_file = '/etc/default/nfs-common' - idmapd_file = '/etc/idmapd.conf' - client_rpcbind_config = '/etc/default/rpcbind' - client_rpcbind_optname = 'OPTIONS' - when 'Debian_9' - - let(:facts) do - default_facts.merge(facts) - end - - server_service = 'nfs-kernel-server' - server_servicehelpers = %w[nfs-idmapd] - server_packages = %w[nfs-common nfs-kernel-server nfs4-acl-tools rpcbind] - client_services = %w[rpcbind] - client_nfs_vfour_services = %w[rpcbind] - client_packages = %w[nfs-common nfs4-acl-tools] - client_gssdopt_name = 'GSSDARGS' - defaults_file = '/etc/default/nfs-common' - idmapd_file = '/etc/idmapd.conf' - client_rpcbind_config = '/etc/default/rpcbind' - client_rpcbind_optname = 'OPTIONS' - - when 'Debian_10' - - let(:facts) do - default_facts.merge(facts) - end - - server_service = 'nfs-kernel-server' - server_servicehelpers = %w[nfs-idmapd] - server_packages = %w[nfs-common nfs-kernel-server nfs4-acl-tools rpcbind] - client_services = %w[rpcbind] - client_nfs_vfour_services = %w[rpcbind] - client_packages = %w[nfs-common nfs4-acl-tools] - client_gssdopt_name = 'GSSDARGS' - defaults_file = '/etc/default/nfs-common' - idmapd_file = '/etc/idmapd.conf' - client_rpcbind_config = '/etc/default/rpcbind' - client_rpcbind_optname = 'OPTIONS' - - when 'Debian_11' - - let(:facts) do - default_facts.merge(facts) - end - - server_service = 'nfs-kernel-server' - server_servicehelpers = %w[nfs-idmapd] - server_packages = %w[nfs-common nfs-kernel-server nfs4-acl-tools rpcbind] - client_services = %w[rpcbind] - client_nfs_vfour_services = %w[rpcbind] - client_packages = %w[nfs-common nfs4-acl-tools] - client_gssdopt_name = 'GSSDARGS' - defaults_file = '/etc/default/nfs-common' - idmapd_file = '/etc/idmapd.conf' - client_rpcbind_config = '/etc/default/rpcbind' - client_rpcbind_optname = 'OPTIONS' - - when 'RedHat_default' + when 'redhat-9-x86_64' let(:facts) do default_facts.merge(facts) @@ -219,7 +85,7 @@ client_rpcbind_config = '/etc/sysconfig/rpcbind' client_rpcbind_optname = 'RPCBIND_ARGS' - when 'RedHat_7' + when 'redhat-7-x86_64' let(:facts) do default_facts.merge(facts) @@ -237,25 +103,7 @@ client_rpcbind_config = '/etc/sysconfig/rpcbind' client_rpcbind_optname = 'RPCBIND_ARGS' - when 'RedHat_75' - - let(:facts) do - default_facts.merge(facts) - end - - server_service = 'nfs-server.service' - server_servicehelpers = %w[nfs-idmap.service] - server_packages = %w[nfs-utils nfs4-acl-tools rpcbind] - client_services = %w[rpcbind.service] - client_nfs_vfour_services = %w[rpcbind] - client_packages = %w[nfs-utils nfs4-acl-tools rpcbind] - client_gssdopt_name = 'RPCGSSDARGS' - defaults_file = '/etc/sysconfig/nfs' - idmapd_file = '/etc/idmapd.conf' - client_rpcbind_config = '/etc/sysconfig/rpcbind' - client_rpcbind_optname = 'RPCBIND_ARGS' - - when 'RedHat_8' + when 'redhat-8-x86_64' let(:facts) do default_facts.merge(facts) @@ -273,23 +121,7 @@ client_rpcbind_config = '/etc/sysconfig/rpcbind' client_rpcbind_optname = 'RPCBIND_ARGS' - when 'Gentoo' - - let(:facts) do - default_facts.merge(facts) - end - - server_service = 'nfs' - server_servicehelpers = %w[rpc.idmapd] - server_packages = %w[net-nds/rpcbind net-fs/nfs-utils net-libs/libnfsidmap] - client_services = %w[rpcbind] - client_nfs_vfour_services = %w[rpcbind rpc.idmapd] - client_packages = %w[net-nds/rpcbind net-fs/nfs-utils net-libs/libnfsidmap] - client_gssdopt_name = 'RPCGSSDARGS' - defaults_file = '/etc/conf.d/nfs' - idmapd_file = '/etc/idmapd.conf' - client_rpcbind_optname = 'OPTS_RPC_NFSD' - when 'SLES' + when 'sles-12-x86_64', 'sles-15-x86_64' let(:facts) do default_facts.merge(facts) @@ -306,23 +138,6 @@ idmapd_file = '/etc/idmapd.conf' client_rpcbind_optname = 'RPCNFSDARGS' - when 'Archlinux' - - let(:facts) do - default_facts.merge(facts) - end - - server_service = 'nfs-server.service' - server_servicehelpers = %w[nfs-idmapd] - server_packages = %w[nfs-utils] - client_services = %w[rpcbind] - client_nfs_vfour_services = %w[rpcbind] - client_packages = %w[nfsidmap rpcbind] - client_gssdopt_name = 'RPCGSSDARGS' - defaults_file = '' - idmapd_file = '/etc/idmapd.conf' - client_rpcbind_optname = 'RPCNFSDARGS' - end ### ^^ Switch Case to set OS specific values ^^ ### From 99eee5b5067ef00c4c079102bfcafa3e3f97c351 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Mon, 3 Jun 2024 15:36:24 +0200 Subject: [PATCH 11/30] rubocop --- spec/classes/nfs_spec.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spec/classes/nfs_spec.rb b/spec/classes/nfs_spec.rb index 97f57654..8d5a6add 100644 --- a/spec/classes/nfs_spec.rb +++ b/spec/classes/nfs_spec.rb @@ -4,7 +4,7 @@ describe 'nfs' do on_supported_os.each do |os, facts| - context "on #{os}" do + context "with default settings on #{os}" do let(:facts) do facts end @@ -66,7 +66,6 @@ client_rpcbind_config = '/etc/default/rpcbind' client_rpcbind_optname = 'OPTIONS' - when 'redhat-9-x86_64' let(:facts) do From f8926955623c7aeb5c2f773e3ec0630c0663aed4 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Fri, 7 Jun 2024 08:51:52 +0200 Subject: [PATCH 12/30] revert new os tests to allow merge of puppet 8 --- metadata.json | 19 +- spec/classes/nfs_spec.rb | 450 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 436 insertions(+), 33 deletions(-) diff --git a/metadata.json b/metadata.json index 4886b296..c34df817 100644 --- a/metadata.json +++ b/metadata.json @@ -19,6 +19,9 @@ { "operatingsystem": "Ubuntu", "operatingsystemrelease": [ + "14.04", + "16.04", + "18.04", "20.04", "22.04" ] @@ -26,16 +29,19 @@ { "operatingsystem": "Debian", "operatingsystemrelease": [ - "11", - "12" + "6", + "7", + "8", + "9", + "10", + "11" ] }, { "operatingsystem": "RedHat", "operatingsystemrelease": [ "7", - "8", - "9" + "8" ] }, { @@ -47,8 +53,7 @@ { "operatingsystem": "SLES", "operatingsystemrelease": [ - "12", - "15" + "12" ] }, { @@ -67,7 +72,7 @@ "requirements": [ { "name": "puppet", - "version_requirement": ">= 7.0.0 < 9.0.0" + "version_requirement": ">= 7.0.0 < 8.0.0" } ] } diff --git a/spec/classes/nfs_spec.rb b/spec/classes/nfs_spec.rb index 8d5a6add..586963f4 100644 --- a/spec/classes/nfs_spec.rb +++ b/spec/classes/nfs_spec.rb @@ -3,11 +3,10 @@ require 'spec_helper' describe 'nfs' do - on_supported_os.each do |os, facts| - context "with default settings on #{os}" do - let(:facts) do - facts - end + # supported_os = %w[Ubuntu_default Ubuntu_16.04 Debian_default Debian_8 RedHat_default RedHat_7 RedHat_75 RedHat_8 Gentoo SLES Archlinux] + supported_os = %w[Ubuntu_16.04 Ubuntu_18.04 Ubuntu_20.04 Ubuntu_22.04 Debian_8 Debian_9 Debian_10 Debian_11 RedHat_default RedHat_7 RedHat_75 RedHat_8 Gentoo SLES] + supported_os.each do |os| + context os do let(:default_facts) do { 'concat_basedir' => '/tmp', @@ -19,21 +18,25 @@ end ### vv switch case to set OS specific values vv ### - ## debian-12-x86_64 - ## ubuntu-20.04-x86_64 - ## redhat-9-x86_64 - ## redhat-8-x86_64 - ## sles-12-x86_64 - ## sles-15-x86_64 - ## debian-11-x86_64 - ## ubuntu-22.04-x86_64 - ## redhat-7-x86_64 case os - when 'ubuntu-22.04-x86_64', 'ubuntu-20.04-x86_64' + when 'Ubuntu_default' let(:facts) do - default_facts.merge(facts) + default_facts.merge( + 'operatingsystem' => 'Ubuntu', + 'os' => { + 'family' => 'Debian', + 'distro' => { + 'codename' => 'trusty' + }, + 'release' => { + 'major' => '14', + 'minor' => '04', + 'full' => '14.04' + } + } + ) end server_service = 'nfs-kernel-server' @@ -48,10 +51,146 @@ client_rpcbind_config = '/etc/default/rpcbind' client_rpcbind_optname = 'OPTIONS' - when 'debian-11-x86_64', 'debian-12-x86_64' + when 'Ubuntu_16.04' + + let(:facts) do + default_facts.merge( + 'operatingsystem' => 'Ubuntu', + 'os' => { + 'family' => 'Debian', + 'distro' => { + 'codename' => 'xenial' + }, + 'release' => { + 'major' => '16', + 'minor' => '04', + 'full' => '16.04' + } + } + ) + end + + server_service = 'nfs-kernel-server' + server_servicehelpers = %w[nfs-idmapd] + server_packages = %w[nfs-common nfs-kernel-server nfs4-acl-tools rpcbind] + client_services = %w[rpcbind] + client_nfs_vfour_services = %w[rpcbind] + client_packages = %w[nfs-common nfs4-acl-tools] + client_gssdopt_name = 'GSSDARGS' + defaults_file = '/etc/default/nfs-common' + idmapd_file = '/etc/idmapd.conf' + client_rpcbind_config = '/etc/default/rpcbind' + client_rpcbind_optname = 'OPTIONS' + + when 'Ubuntu_18.04' let(:facts) do - default_facts.merge(facts) + default_facts.merge( + 'operatingsystem' => 'Ubuntu', + 'os' => { + 'family' => 'Debian', + 'distro' => { + 'codename' => 'bionic' + }, + 'release' => { + 'major' => '18', + 'minor' => '04', + 'full' => '18.04' + } + } + ) + end + + server_service = 'nfs-kernel-server' + server_servicehelpers = '' + server_packages = %w[nfs-common nfs-kernel-server nfs4-acl-tools rpcbind] + client_services = %w[rpcbind] + client_nfs_vfour_services = %w[rpcbind] + client_packages = %w[nfs-common nfs4-acl-tools] + client_gssdopt_name = 'GSSDARGS' + defaults_file = '/etc/default/nfs-common' + idmapd_file = '/etc/idmapd.conf' + client_rpcbind_config = '/etc/default/rpcbind' + client_rpcbind_optname = 'OPTIONS' + + when 'Ubuntu_20.04' + + let(:facts) do + default_facts.merge( + 'operatingsystem' => 'Ubuntu', + 'os' => { + 'family' => 'Debian', + 'distro' => { + 'codename' => 'focal' + }, + 'release' => { + 'major' => '20', + 'minor' => '04', + 'full' => '20.04' + } + } + ) + end + + server_service = 'nfs-kernel-server' + server_servicehelpers = '' + server_packages = %w[nfs-common nfs-kernel-server nfs4-acl-tools rpcbind] + client_services = %w[rpcbind] + client_nfs_vfour_services = %w[rpcbind] + client_packages = %w[nfs-common nfs4-acl-tools] + client_gssdopt_name = 'GSSDARGS' + defaults_file = '/etc/default/nfs-common' + idmapd_file = '/etc/idmapd.conf' + client_rpcbind_config = '/etc/default/rpcbind' + client_rpcbind_optname = 'OPTIONS' + + when 'Ubuntu_22.04' + + let(:facts) do + default_facts.merge( + 'operatingsystem' => 'Ubuntu', + 'os' => { + 'family' => 'Debian', + 'distro' => { + 'codename' => 'focal' + }, + 'release' => { + 'major' => '20', + 'minor' => '04', + 'full' => '20.04' + } + } + ) + end + + server_service = 'nfs-kernel-server' + server_servicehelpers = '' + server_packages = %w[nfs-common nfs-kernel-server nfs4-acl-tools rpcbind] + client_services = %w[rpcbind] + client_nfs_vfour_services = %w[rpcbind] + client_packages = %w[nfs-common nfs4-acl-tools] + client_gssdopt_name = 'GSSDARGS' + defaults_file = '/etc/default/nfs-common' + idmapd_file = '/etc/idmapd.conf' + client_rpcbind_config = '/etc/default/rpcbind' + client_rpcbind_optname = 'OPTIONS' + + when 'Debian_default' + + let(:facts) do + default_facts.merge( + 'operatingsystem' => 'Debian', + 'os' => { + 'family' => 'Debian', + 'distro' => { + 'codename' => 'wheezy' + }, + 'release' => { + 'major' => '7', + 'full' => '7' + } + } + ) end server_service = 'nfs-kernel-server' @@ -66,10 +205,142 @@ client_rpcbind_config = '/etc/default/rpcbind' client_rpcbind_optname = 'OPTIONS' - when 'redhat-9-x86_64' + when 'Debian_8' + + let(:facts) do + default_facts.merge( + 'operatingsystem' => 'Debian', + 'os' => { + 'family' => 'Debian', + 'distro' => { + 'codename' => 'jessie' + }, + 'release' => { + 'major' => '8', + 'full' => '8' + } + } + ) + end + + server_service = 'nfs-kernel-server' + server_servicehelpers = %w[nfs-common] + server_packages = %w[nfs-common nfs-kernel-server nfs4-acl-tools rpcbind] + client_services = %w[rpcbind] + client_nfs_vfour_services = %w[rpcbind nfs-common] + client_packages = %w[nfs-common nfs4-acl-tools] + client_gssdopt_name = 'RPCGSSDOPTS' + defaults_file = '/etc/default/nfs-common' + idmapd_file = '/etc/idmapd.conf' + client_rpcbind_config = '/etc/default/rpcbind' + client_rpcbind_optname = 'OPTIONS' + + when 'Debian_9' + + let(:facts) do + default_facts.merge( + 'operatingsystem' => 'Debian', + 'os' => { + 'family' => 'Debian', + 'distro' => { + 'codename' => 'stretch' + }, + 'release' => { + 'major' => '9', + 'full' => '9' + } + } + ) + end + + server_service = 'nfs-kernel-server' + server_servicehelpers = %w[nfs-idmapd] + server_packages = %w[nfs-common nfs-kernel-server nfs4-acl-tools rpcbind] + client_services = %w[rpcbind] + client_nfs_vfour_services = %w[rpcbind] + client_packages = %w[nfs-common nfs4-acl-tools] + client_gssdopt_name = 'GSSDARGS' + defaults_file = '/etc/default/nfs-common' + idmapd_file = '/etc/idmapd.conf' + client_rpcbind_config = '/etc/default/rpcbind' + client_rpcbind_optname = 'OPTIONS' + + when 'Debian_10' let(:facts) do - default_facts.merge(facts) + default_facts.merge( + 'operatingsystem' => 'Debian', + 'os' => { + 'family' => 'Debian', + 'distro' => { + 'codename' => 'buster' + }, + 'release' => { + 'major' => '10', + 'full' => '10' + } + } + ) + end + + server_service = 'nfs-kernel-server' + server_servicehelpers = %w[nfs-idmapd] + server_packages = %w[nfs-common nfs-kernel-server nfs4-acl-tools rpcbind] + client_services = %w[rpcbind] + client_nfs_vfour_services = %w[rpcbind] + client_packages = %w[nfs-common nfs4-acl-tools] + client_gssdopt_name = 'GSSDARGS' + defaults_file = '/etc/default/nfs-common' + idmapd_file = '/etc/idmapd.conf' + client_rpcbind_config = '/etc/default/rpcbind' + client_rpcbind_optname = 'OPTIONS' + + when 'Debian_11' + + let(:facts) do + default_facts.merge( + 'operatingsystem' => 'Debian', + 'os' => { + 'family' => 'Debian', + 'distro' => { + 'codename' => 'bullseye' + }, + 'release' => { + 'major' => '11', + 'full' => '11' + } + } + ) + end + + server_service = 'nfs-kernel-server' + server_servicehelpers = %w[nfs-idmapd] + server_packages = %w[nfs-common nfs-kernel-server nfs4-acl-tools rpcbind] + client_services = %w[rpcbind] + client_nfs_vfour_services = %w[rpcbind] + client_packages = %w[nfs-common nfs4-acl-tools] + client_gssdopt_name = 'GSSDARGS' + defaults_file = '/etc/default/nfs-common' + idmapd_file = '/etc/idmapd.conf' + client_rpcbind_config = '/etc/default/rpcbind' + client_rpcbind_optname = 'OPTIONS' + + when 'RedHat_default' + + let(:facts) do + default_facts.merge( + 'operatingsystem' => 'RedHat', + 'os' => { + 'family' => 'RedHat', + 'distro' => { + 'codename' => 'RedHat 6' + }, + 'release' => { + 'major' => '6', + 'full' => '6' + } + } + ) end server_service = 'nfs' @@ -84,10 +355,23 @@ client_rpcbind_config = '/etc/sysconfig/rpcbind' client_rpcbind_optname = 'RPCBIND_ARGS' - when 'redhat-7-x86_64' + when 'RedHat_7' let(:facts) do - default_facts.merge(facts) + default_facts.merge( + 'operatingsystem' => 'RedHat', + 'os' => { + 'family' => 'RedHat', + 'distro' => { + 'codename' => 'RedHat 7.4' + }, + 'release' => { + 'major' => '7', + 'minor' => '4', + 'full' => '7.4' + } + } + ) end server_service = 'nfs-server.service' @@ -102,10 +386,54 @@ client_rpcbind_config = '/etc/sysconfig/rpcbind' client_rpcbind_optname = 'RPCBIND_ARGS' - when 'redhat-8-x86_64' + when 'RedHat_75' let(:facts) do - default_facts.merge(facts) + default_facts.merge( + 'operatingsystem' => 'RedHat', + 'os' => { + 'family' => 'RedHat', + 'distro' => { + 'codename' => 'RedHat 7.5' + }, + 'release' => { + 'major' => '7', + 'minor' => '5', + 'full' => '7.5' + } + } + ) + end + + server_service = 'nfs-server.service' + server_servicehelpers = %w[nfs-idmap.service] + server_packages = %w[nfs-utils nfs4-acl-tools rpcbind] + client_services = %w[rpcbind.service] + client_nfs_vfour_services = %w[rpcbind] + client_packages = %w[nfs-utils nfs4-acl-tools rpcbind] + client_gssdopt_name = 'RPCGSSDARGS' + defaults_file = '/etc/sysconfig/nfs' + idmapd_file = '/etc/idmapd.conf' + client_rpcbind_config = '/etc/sysconfig/rpcbind' + client_rpcbind_optname = 'RPCBIND_ARGS' + + when 'RedHat_8' + + let(:facts) do + default_facts.merge( + 'operatingsystem' => 'RedHat', + 'os' => { + 'family' => 'RedHat', + 'distro' => { + 'codename' => 'RedHat 8' + }, + 'release' => { + 'major' => '8', + 'minor' => '0', + 'full' => '8.0' + } + } + ) end server_service = 'nfs-server.service' @@ -120,10 +448,51 @@ client_rpcbind_config = '/etc/sysconfig/rpcbind' client_rpcbind_optname = 'RPCBIND_ARGS' - when 'sles-12-x86_64', 'sles-15-x86_64' + when 'Gentoo' + + let(:facts) do + default_facts.merge( + 'operatingsystem' => 'Gentoo', + 'os' => { + 'family' => 'Gentoo', + 'distro' => { + 'codename' => 'Gentoo' + }, + 'release' => { + 'major' => '1', + 'minor' => '0', + 'full' => '1.0' + } + } + ) + end + + server_service = 'nfs' + server_servicehelpers = %w[rpc.idmapd] + server_packages = %w[net-nds/rpcbind net-fs/nfs-utils net-libs/libnfsidmap] + client_services = %w[rpcbind] + client_nfs_vfour_services = %w[rpcbind rpc.idmapd] + client_packages = %w[net-nds/rpcbind net-fs/nfs-utils net-libs/libnfsidmap] + client_gssdopt_name = 'RPCGSSDARGS' + defaults_file = '/etc/conf.d/nfs' + idmapd_file = '/etc/idmapd.conf' + client_rpcbind_optname = 'OPTS_RPC_NFSD' + when 'SLES' let(:facts) do - default_facts.merge(facts) + default_facts.merge( + 'operatingsystem' => 'SLES', + 'os' => { + 'family' => 'Suse', + 'distro' => { + 'codename' => 'SLES' + }, + 'release' => { + 'major' => '12', + 'full' => '12' + } + } + ) end server_service = 'nfsserver' @@ -137,6 +506,35 @@ idmapd_file = '/etc/idmapd.conf' client_rpcbind_optname = 'RPCNFSDARGS' + when 'Archlinux' + + let(:facts) do + default_facts.merge( + 'operatingsystem' => 'Archlinux', + 'os' => { + 'family' => 'Archlinux', + 'distro' => { + 'codename' => 'Archlinux' + }, + 'release' => { + 'major' => '3', + 'full' => '3' + } + } + ) + end + + server_service = 'nfs-server.service' + server_servicehelpers = %w[nfs-idmapd] + server_packages = %w[nfs-utils] + client_services = %w[rpcbind] + client_nfs_vfour_services = %w[rpcbind] + client_packages = %w[nfsidmap rpcbind] + client_gssdopt_name = 'RPCGSSDARGS' + defaults_file = '' + idmapd_file = '/etc/idmapd.conf' + client_rpcbind_optname = 'RPCNFSDARGS' + end ### ^^ Switch Case to set OS specific values ^^ ### From 22e46d0483f885b99b842aced13c1b7c6cfd8743 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Fri, 7 Jun 2024 09:20:25 +0200 Subject: [PATCH 13/30] enable puppet 8 tests --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index c34df817..bbcac9d6 100644 --- a/metadata.json +++ b/metadata.json @@ -72,7 +72,7 @@ "requirements": [ { "name": "puppet", - "version_requirement": ">= 7.0.0 < 8.0.0" + "version_requirement": ">= 7.0.0 < 9.0.0" } ] } From 35fa0a690bafd15cd0362847f1e3c79027f4bddf Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Fri, 7 Jun 2024 09:45:47 +0200 Subject: [PATCH 14/30] rebase after modulesync --- .github/ISSUE_TEMPLATE.md | 26 ++++++ .github/PULL_REQUEST_TEMPLATE.md | 20 +++++ .github/workflows/release.yml | 22 ++++++ .github/workflows/test-suite.yaml | 127 ++++++++++++++++++++++++++++++ 4 files changed, 195 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/test-suite.yaml diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 00000000..593e7aa8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,26 @@ + + +## Affected Puppet, Ruby, OS and module versions/distributions + +- Puppet: +- Ruby: +- Distribution: +- Module version: + +## How to reproduce (e.g Puppet code you use) + +## What are you seeing + +## What behaviour did you expect instead + +## Output log + +## Any additional information you'd like to impart diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..342807bc --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,20 @@ + +#### Pull Request (PR) description + + +#### This Pull Request (PR) fixes the following issues + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..55324aa6 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,22 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +name: Release + +on: + push: + tags: + - '*' + +jobs: + release: + name: Release + uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v2 + with: + allowed_owner: 'voxpupuli' + secrets: + # Configure secrets here: + # https://docs.github.com/en/actions/security-guides/encrypted-secrets + username: ${{ secrets.PUPPET_FORGE_USERNAME }} + api_key: ${{ secrets.PUPPET_FORGE_API_KEY }} diff --git a/.github/workflows/test-suite.yaml b/.github/workflows/test-suite.yaml new file mode 100644 index 00000000..0dec901b --- /dev/null +++ b/.github/workflows/test-suite.yaml @@ -0,0 +1,127 @@ +name: Test suite + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + test-static-current: + strategy: + fail-fast: false + matrix: + puppet: [7.22.0] + ruby: [2.7.7, 3.0.5, 3.1.3] + + name: Static code analysis + runs-on: ubuntu-20.04 + permissions: + contents: read + + steps: + - uses: actions/checkout@v3 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + env: + PUPPET_VERSION: ${{ matrix.puppet }} + + - name: Run metadata lint + run: | + PUPPET_VERSION=${{ matrix.puppet }} bundle exec rake metadata_lint + + - name: Run puppet lint + run: | + PUPPET_VERSION=${{ matrix.puppet }} bundle exec rake lint + + - name: Run puppet syntax check + run: | + PUPPET_VERSION=${{ matrix.puppet }} bundle exec rake syntax + + - name: Run puppet rspec tests + run: | + PUPPET_VERSION=${{ matrix.puppet }} STRICT_VARIABLES=yes bundle exec rake spec + + - name: Run rubocop tests + run: | + PUPPET_VERSION=${{ matrix.puppet }} bundle exec rake rubocop + + test-static-old: + strategy: + fail-fast: false + matrix: + puppet: [5.5.22, 6.29.0] + ruby: [2.5.9, 2.6.9] + + name: Static code analysis + runs-on: ubuntu-20.04 + permissions: + contents: read + + steps: + - uses: actions/checkout@v3 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + env: + PUPPET_VERSION: ${{ matrix.puppet }} + + - name: Run metadata lint + run: | + PUPPET_VERSION=${{ matrix.puppet }} bundle exec rake metadata_lint + + - name: Run puppet lint + run: | + PUPPET_VERSION=${{ matrix.puppet }} bundle exec rake lint + + - name: Run puppet syntax check + run: | + PUPPET_VERSION=${{ matrix.puppet }} bundle exec rake syntax + + - name: Run puppet rspec tests + run: | + PUPPET_VERSION=${{ matrix.puppet }} STRICT_VARIABLES=yes bundle exec rake spec + + - name: Run rubocop tests + run: | + PUPPET_VERSION=${{ matrix.puppet }} bundle exec rake rubocop + + test-integration: + strategy: + fail-fast: false + matrix: + puppet: [puppet6, puppet7] + beakerset: [ubuntu-18.04, ubuntu-20.04, ubuntu-22.04, centos-7, debian-10, debian-11] + + name: Integration tests + runs-on: ubuntu-20.04 + permissions: + contents: read + + steps: + - uses: actions/checkout@v2 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.6.9 + bundler-cache: true + env: + BEAKER_set: ${{ matrix.beakerset }} + BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet }} + PUPPET_INSTALL_TYPE: agent + + - name: Run puppet-beaker tests + run: | + BEAKER_destroy=yes bundle exec rake acceptance + env: + BEAKER_set: ${{ matrix.beakerset }} + BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet }} + PUPPET_INSTALL_TYPE: agent From e1fd3944a4c0c5e4ae12d14d5afc638a6e707336 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Fri, 7 Jun 2024 09:46:44 +0200 Subject: [PATCH 15/30] remove ruby-lsp artefact --- .../3.2.0/ed25519-1.3.0/gem_make.out | 110 ------------------ 1 file changed, 110 deletions(-) delete mode 100644 .ruby-lsp/vendor/ruby/3.2.0/extensions/x86_64-darwin-22/3.2.0/ed25519-1.3.0/gem_make.out diff --git a/.ruby-lsp/vendor/ruby/3.2.0/extensions/x86_64-darwin-22/3.2.0/ed25519-1.3.0/gem_make.out b/.ruby-lsp/vendor/ruby/3.2.0/extensions/x86_64-darwin-22/3.2.0/ed25519-1.3.0/gem_make.out deleted file mode 100644 index 57aabd8e..00000000 --- a/.ruby-lsp/vendor/ruby/3.2.0/extensions/x86_64-darwin-22/3.2.0/ed25519-1.3.0/gem_make.out +++ /dev/null @@ -1,110 +0,0 @@ -current directory: /Users/mea/Documents/github/puppet/derdanne-nfs/.ruby-lsp/vendor/ruby/3.2.0/gems/ed25519-1.3.0/ext/ed25519_ref10 -/Users/mea/.rvm/rubies/ruby-3.2.2/bin/ruby extconf.rb -/Users/mea/.rvm/rubies/ruby-3.2.2/bin/ruby: warning: Ruby was built without YJIT support. You may need to install rustc to build Ruby with YJIT. -creating Makefile - -current directory: /Users/mea/Documents/github/puppet/derdanne-nfs/.ruby-lsp/vendor/ruby/3.2.0/gems/ed25519-1.3.0/ext/ed25519_ref10 -make DESTDIR\= sitearchdir\=./.gem.20240603-98069-nm1ndb sitelibdir\=./.gem.20240603-98069-nm1ndb clean - -current directory: /Users/mea/Documents/github/puppet/derdanne-nfs/.ruby-lsp/vendor/ruby/3.2.0/gems/ed25519-1.3.0/ext/ed25519_ref10 -make DESTDIR\= sitearchdir\=./.gem.20240603-98069-nm1ndb sitelibdir\=./.gem.20240603-98069-nm1ndb -compiling ed25519_ref10.c -In file included from ed25519_ref10.c:1: -In file included from /Users/mea/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/ruby.h:38: -In file included from /Users/mea/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/ruby/ruby.h:27: -In file included from /Users/mea/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/ruby/internal/anyargs.h:76: -/Users/mea/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/ruby/internal/intern/class.h:301:60: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes] -void rb_define_method_id(VALUE klass, ID mid, VALUE (*func)(ANYARGS), int arity); - ^ - void -/Users/mea/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/ruby/internal/intern/class.h:339:76: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes] -void rb_define_protected_method(VALUE klass, const char *mid, VALUE (*func)(ANYARGS), int arity); - ^ - void -/Users/mea/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/ruby/internal/intern/class.h:352:74: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes] -void rb_define_private_method(VALUE klass, const char *mid, VALUE (*func)(ANYARGS), int arity); - ^ - void -/Users/mea/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/ruby/internal/intern/class.h:365:73: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes] -void rb_define_singleton_method(VALUE obj, const char *mid, VALUE(*func)(ANYARGS), int arity); - ^ - void -In file included from ed25519_ref10.c:1: -In file included from /Users/mea/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/ruby.h:38: -In file included from /Users/mea/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/ruby/ruby.h:27: -In file included from /Users/mea/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/ruby/internal/anyargs.h:78: -/Users/mea/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/ruby/internal/method.h:99:66: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes] -void rb_define_method(VALUE klass, const char *mid, VALUE (*func)(ANYARGS), int arity); - ^ - void -/Users/mea/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/ruby/internal/method.h:112:75: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes] -void rb_define_module_function(VALUE klass, const char *mid, VALUE (*func)(ANYARGS), int arity); - ^ - void -/Users/mea/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/ruby/internal/method.h:124:62: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes] -void rb_define_global_function(const char *mid, VALUE (*func)(ANYARGS), int arity); - ^ - void -In file included from ed25519_ref10.c:1: -In file included from /Users/mea/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/ruby.h:38: -In file included from /Users/mea/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/ruby/ruby.h:27: -/Users/mea/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/ruby/internal/anyargs.h:271:1: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes] -RBIMPL_ANYARGS_DECL(rb_define_singleton_method, VALUE, const char *) -^ -/Users/mea/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/ruby/internal/anyargs.h:252:73: note: expanded from macro 'RBIMPL_ANYARGS_DECL' -RBIMPL_ANYARGS_ATTRSET(sym) static void sym ## _m3(__VA_ARGS__, VALUE(*)(ANYARGS), int); \ - ^ -/Users/mea/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/ruby/internal/anyargs.h:272:1: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes] -RBIMPL_ANYARGS_DECL(rb_define_protected_method, VALUE, const char *) -^ -/Users/mea/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/ruby/internal/anyargs.h:252:73: note: expanded from macro 'RBIMPL_ANYARGS_DECL' -RBIMPL_ANYARGS_ATTRSET(sym) static void sym ## _m3(__VA_ARGS__, VALUE(*)(ANYARGS), int); \ - ^ -/Users/mea/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/ruby/internal/anyargs.h:273:1: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes] -RBIMPL_ANYARGS_DECL(rb_define_private_method, VALUE, const char *) -^ -/Users/mea/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/ruby/internal/anyargs.h:252:73: note: expanded from macro 'RBIMPL_ANYARGS_DECL' -RBIMPL_ANYARGS_ATTRSET(sym) static void sym ## _m3(__VA_ARGS__, VALUE(*)(ANYARGS), int); \ - ^ -/Users/mea/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/ruby/internal/anyargs.h:274:1: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes] -RBIMPL_ANYARGS_DECL(rb_define_module_function, VALUE, const char *) -^ -/Users/mea/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/ruby/internal/anyargs.h:252:73: note: expanded from macro 'RBIMPL_ANYARGS_DECL' -RBIMPL_ANYARGS_ATTRSET(sym) static void sym ## _m3(__VA_ARGS__, VALUE(*)(ANYARGS), int); \ - ^ -/Users/mea/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/ruby/internal/anyargs.h:275:1: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes] -RBIMPL_ANYARGS_DECL(rb_define_global_function, const char *) -^ -/Users/mea/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/ruby/internal/anyargs.h:252:73: note: expanded from macro 'RBIMPL_ANYARGS_DECL' -RBIMPL_ANYARGS_ATTRSET(sym) static void sym ## _m3(__VA_ARGS__, VALUE(*)(ANYARGS), int); \ - ^ -/Users/mea/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/ruby/internal/anyargs.h:276:1: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes] -RBIMPL_ANYARGS_DECL(rb_define_method_id, VALUE, ID) -^ -/Users/mea/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/ruby/internal/anyargs.h:252:73: note: expanded from macro 'RBIMPL_ANYARGS_DECL' -RBIMPL_ANYARGS_ATTRSET(sym) static void sym ## _m3(__VA_ARGS__, VALUE(*)(ANYARGS), int); \ - ^ -/Users/mea/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/ruby/internal/anyargs.h:277:1: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes] -RBIMPL_ANYARGS_DECL(rb_define_method, VALUE, const char *) -^ -/Users/mea/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/ruby/internal/anyargs.h:252:73: note: expanded from macro 'RBIMPL_ANYARGS_DECL' -RBIMPL_ANYARGS_ATTRSET(sym) static void sym ## _m3(__VA_ARGS__, VALUE(*)(ANYARGS), int); \ - ^ -ed25519_ref10.c:12:24: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes] -void Init_ed25519_ref10() - ^ - void -15 warnings generated. -compiling fe.c -compiling ge.c -compiling keypair.c -compiling open.c -compiling sc_muladd.c -compiling sc_reduce.c -compiling sha512.c -Rename failed: /Users/mea/Documents/github/puppet/derdanne-nfs/.ruby-lsp/vendor/ruby/3.2.0/gems/ed25519-1.3.0/ext/ed25519_ref10/sha512-5119834e.o.tmp -> /Users/mea/Documents/github/puppet/derdanne-nfs/.ruby-lsp/vendor/ruby/3.2.0/gems/ed25519-1.3.0/ext/ed25519_ref10/sha512.o: No such file or directory -error: unable to rename temporary '/Users/mea/Documents/github/puppet/derdanne-nfs/.ruby-lsp/vendor/ruby/3.2.0/gems/ed25519-1.3.0/ext/ed25519_ref10/sha512-5119834e.o.tmp' to output file '/Users/mea/Documents/github/puppet/derdanne-nfs/.ruby-lsp/vendor/ruby/3.2.0/gems/ed25519-1.3.0/ext/ed25519_ref10/sha512.o': 'No such file or directory' -1 error generated. -make: *** [sha512.o] Error 1 - -make failed, exit code 2 From c821684fda17e55ebdd30c2018a43a3bbd214e2e Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Fri, 7 Jun 2024 09:54:01 +0200 Subject: [PATCH 16/30] rubocop cleanup --- spec/classes/nfs_spec.rb | 6 +++--- spec/spec_helper_acceptance.rb | 34 +++++++++++++++++----------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/spec/classes/nfs_spec.rb b/spec/classes/nfs_spec.rb index 586963f4..5b662a28 100644 --- a/spec/classes/nfs_spec.rb +++ b/spec/classes/nfs_spec.rb @@ -152,12 +152,12 @@ 'os' => { 'family' => 'Debian', 'distro' => { - 'codename' => 'focal' + 'codename' => 'jammy' }, 'release' => { - 'major' => '20', + 'major' => '22', 'minor' => '04', - 'full' => '20.04' + 'full' => '22.04' } } ) diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 43721ab5..b6e66b32 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -4,27 +4,27 @@ c.mock_with :rspec end require 'voxpupuli/acceptance/spec_helper_acceptance' -#require 'beaker-rspec/spec_helper' -#require 'beaker/puppet_install_helper' +# require 'beaker-rspec/spec_helper' +# require 'beaker/puppet_install_helper' -#run_puppet_install_helper +# run_puppet_install_helper -#RSpec.configure do |c| -# module_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) +# RSpec.configure do |c| +# module_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) # -# c.formatter = :documentation +# c.formatter = :documentation # -# c.before :suite do -# puppet_module_install( -# source: module_root, -# module_name: 'nfs' -# ) -# hosts.each do |host| -# on host, puppet('module', 'install', 'puppetlabs-stdlib'), acceptable_exit_codes: [0, 1] -# on host, puppet('module', 'install', 'puppetlabs-concat'), acceptable_exit_codes: [0, 1] -# end -# end -#end +# c.before :suite do +# puppet_module_install( +# source: module_root, +# module_name: 'nfs' +# ) +# hosts.each do |host| +# on host, puppet('module', 'install', 'puppetlabs-stdlib'), acceptable_exit_codes: [0, 1] +# on host, puppet('module', 'install', 'puppetlabs-concat'), acceptable_exit_codes: [0, 1] +# end +# end +# end configure_beaker do |host| on host, puppet('module', 'install', 'puppetlabs-stdlib'), acceptable_exit_codes: [0, 1] From 2aa5800afb1b5396a843dcd391c840246ace7880 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Fri, 7 Jun 2024 10:30:24 +0200 Subject: [PATCH 17/30] remove outdated os add migrastion note, add badges --- README.md | 9 +++++++++ metadata.json | 9 +-------- spec/classes/nfs_spec.rb | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 0ab7d836..be9d937b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,14 @@ # nfs +[![Build Status](https://github.com/voxpupuli/puppet-nfs/workflows/CI/badge.svg)](https://github.com/voxpupuli/puppet-nfs/actions?query=workflow%3ACI) +[![Code Coverage](https://coveralls.io/repos/github/voxpupuli/puppet-nfs/badge.svg?branch=master)](https://coveralls.io/github/voxpupuli/puppet-nfs) +[![Puppet Forge](https://img.shields.io/puppetforge/v/puppet/nfs.svg)](https://forge.puppetlabs.com/puppet/nfs) +[![Puppet Forge - downloads](https://img.shields.io/puppetforge/dt/puppet/nfs.svg)](https://forge.puppetlabs.com/puppet/nfs) +[![Puppet Forge - endorsement](https://img.shields.io/puppetforge/e/puppet/nfs.svg)](https://forge.puppetlabs.com/puppet/nfs) +[![Puppet Forge - scores](https://img.shields.io/puppetforge/f/puppet/nfs.svg)](https://forge.puppetlabs.com/puppet/nfs) + +This module was migrated from Daniel Klockenkaemper to Vox Pupuli. + #### Table of Contents 1. [Module Description - What the module does and why it is useful](#module-description) 2. [Setup - The basics of getting started with puppet-nfs](#setup) diff --git a/metadata.json b/metadata.json index bbcac9d6..5f8cf3d9 100644 --- a/metadata.json +++ b/metadata.json @@ -2,7 +2,7 @@ "name": "puppet-nfs", "version": "2.1.11", "source": "https://github.com/voxpupuli/puppet-nfs.git", - "author": "derdanne", + "author": "Voxpupuli Community", "license": "Apache-2.0", "summary": "Installs and configures NFS server and clients", "project_page": "https://github.com/voxpupuli/puppet-nfs", @@ -19,9 +19,6 @@ { "operatingsystem": "Ubuntu", "operatingsystemrelease": [ - "14.04", - "16.04", - "18.04", "20.04", "22.04" ] @@ -29,10 +26,6 @@ { "operatingsystem": "Debian", "operatingsystemrelease": [ - "6", - "7", - "8", - "9", "10", "11" ] diff --git a/spec/classes/nfs_spec.rb b/spec/classes/nfs_spec.rb index 5b662a28..0926f7fc 100644 --- a/spec/classes/nfs_spec.rb +++ b/spec/classes/nfs_spec.rb @@ -4,7 +4,7 @@ describe 'nfs' do # supported_os = %w[Ubuntu_default Ubuntu_16.04 Debian_default Debian_8 RedHat_default RedHat_7 RedHat_75 RedHat_8 Gentoo SLES Archlinux] - supported_os = %w[Ubuntu_16.04 Ubuntu_18.04 Ubuntu_20.04 Ubuntu_22.04 Debian_8 Debian_9 Debian_10 Debian_11 RedHat_default RedHat_7 RedHat_75 RedHat_8 Gentoo SLES] + supported_os = %w[Ubuntu_20.04 Ubuntu_22.04 Debian_10 Debian_11 RedHat_default RedHat_7 RedHat_75 RedHat_8 Gentoo SLES] supported_os.each do |os| context os do let(:default_facts) do From e03dec5fed49110921c73f2bd49e48fe055537f9 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Fri, 7 Jun 2024 10:34:01 +0200 Subject: [PATCH 18/30] remove old test suite --- .github/workflows/test-suite.yaml | 127 ------------------------------ 1 file changed, 127 deletions(-) delete mode 100644 .github/workflows/test-suite.yaml diff --git a/.github/workflows/test-suite.yaml b/.github/workflows/test-suite.yaml deleted file mode 100644 index 0dec901b..00000000 --- a/.github/workflows/test-suite.yaml +++ /dev/null @@ -1,127 +0,0 @@ -name: Test suite - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - test-static-current: - strategy: - fail-fast: false - matrix: - puppet: [7.22.0] - ruby: [2.7.7, 3.0.5, 3.1.3] - - name: Static code analysis - runs-on: ubuntu-20.04 - permissions: - contents: read - - steps: - - uses: actions/checkout@v3 - - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - bundler-cache: true - env: - PUPPET_VERSION: ${{ matrix.puppet }} - - - name: Run metadata lint - run: | - PUPPET_VERSION=${{ matrix.puppet }} bundle exec rake metadata_lint - - - name: Run puppet lint - run: | - PUPPET_VERSION=${{ matrix.puppet }} bundle exec rake lint - - - name: Run puppet syntax check - run: | - PUPPET_VERSION=${{ matrix.puppet }} bundle exec rake syntax - - - name: Run puppet rspec tests - run: | - PUPPET_VERSION=${{ matrix.puppet }} STRICT_VARIABLES=yes bundle exec rake spec - - - name: Run rubocop tests - run: | - PUPPET_VERSION=${{ matrix.puppet }} bundle exec rake rubocop - - test-static-old: - strategy: - fail-fast: false - matrix: - puppet: [5.5.22, 6.29.0] - ruby: [2.5.9, 2.6.9] - - name: Static code analysis - runs-on: ubuntu-20.04 - permissions: - contents: read - - steps: - - uses: actions/checkout@v3 - - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - bundler-cache: true - env: - PUPPET_VERSION: ${{ matrix.puppet }} - - - name: Run metadata lint - run: | - PUPPET_VERSION=${{ matrix.puppet }} bundle exec rake metadata_lint - - - name: Run puppet lint - run: | - PUPPET_VERSION=${{ matrix.puppet }} bundle exec rake lint - - - name: Run puppet syntax check - run: | - PUPPET_VERSION=${{ matrix.puppet }} bundle exec rake syntax - - - name: Run puppet rspec tests - run: | - PUPPET_VERSION=${{ matrix.puppet }} STRICT_VARIABLES=yes bundle exec rake spec - - - name: Run rubocop tests - run: | - PUPPET_VERSION=${{ matrix.puppet }} bundle exec rake rubocop - - test-integration: - strategy: - fail-fast: false - matrix: - puppet: [puppet6, puppet7] - beakerset: [ubuntu-18.04, ubuntu-20.04, ubuntu-22.04, centos-7, debian-10, debian-11] - - name: Integration tests - runs-on: ubuntu-20.04 - permissions: - contents: read - - steps: - - uses: actions/checkout@v2 - - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: 2.6.9 - bundler-cache: true - env: - BEAKER_set: ${{ matrix.beakerset }} - BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet }} - PUPPET_INSTALL_TYPE: agent - - - name: Run puppet-beaker tests - run: | - BEAKER_destroy=yes bundle exec rake acceptance - env: - BEAKER_set: ${{ matrix.beakerset }} - BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet }} - PUPPET_INSTALL_TYPE: agent From 3a75a2085a216a115697b4ec15cc13eb7542f2b5 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Fri, 7 Jun 2024 11:27:51 +0200 Subject: [PATCH 19/30] no need to install modules on your own --- spec/spec_helper_acceptance.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index b6e66b32..75c9b9a9 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true -RSpec.configure do |c| - c.mock_with :rspec -end +# RSpec.configure do |c| +# c.mock_with :rspec +# end require 'voxpupuli/acceptance/spec_helper_acceptance' # require 'beaker-rspec/spec_helper' # require 'beaker/puppet_install_helper' @@ -26,7 +26,7 @@ # end # end -configure_beaker do |host| - on host, puppet('module', 'install', 'puppetlabs-stdlib'), acceptable_exit_codes: [0, 1] - on host, puppet('module', 'install', 'puppetlabs-concat'), acceptable_exit_codes: [0, 1] -end +# configure_beaker do |host| +# on host, puppet('module', 'install', 'puppetlabs-stdlib'), acceptable_exit_codes: [0, 1] +# on host, puppet('module', 'install', 'puppetlabs-concat'), acceptable_exit_codes: [0, 1] +# end From 6b6cd7e5d6eaaf8e3cf376d36092e8e18601895e Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Fri, 7 Jun 2024 11:29:51 +0200 Subject: [PATCH 20/30] add missing configure_beaker --- spec/spec_helper_acceptance.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 75c9b9a9..18b500cb 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -30,3 +30,5 @@ # on host, puppet('module', 'install', 'puppetlabs-stdlib'), acceptable_exit_codes: [0, 1] # on host, puppet('module', 'install', 'puppetlabs-concat'), acceptable_exit_codes: [0, 1] # end +configure_beaker + From e4c6eac1ed263f7b694f8c8680b58beafba25c40 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Fri, 7 Jun 2024 11:56:39 +0200 Subject: [PATCH 21/30] rubocop --- spec/spec_helper_acceptance.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 18b500cb..b2efb870 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -31,4 +31,3 @@ # on host, puppet('module', 'install', 'puppetlabs-concat'), acceptable_exit_codes: [0, 1] # end configure_beaker - From 8636f3e7540645c8d55a3ba22fa0ffb14c9f6f48 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Fri, 7 Jun 2024 12:02:21 +0200 Subject: [PATCH 22/30] update module dependencies --- metadata.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/metadata.json b/metadata.json index 5f8cf3d9..b4bcf00e 100644 --- a/metadata.json +++ b/metadata.json @@ -8,11 +8,11 @@ "project_page": "https://github.com/voxpupuli/puppet-nfs", "issues_url": "https://github.com/voxpupuli/puppet-nfs/issues", "dependencies": [ - {"name":"puppetlabs/stdlib","version_requirement":">= 4.5.0 < 9.0.0"}, - {"name":"puppetlabs/concat","version_requirement":">= 1.1.2 < 8.0.0"}, - {"name":"puppetlabs/transition","version_requirement":">= 0.1.0 < 2.0.0"}, - {"name":"puppet/augeasproviders_core","version_requirement":">= 2.1.5 < 4.0.0"}, - {"name":"puppet/augeasproviders_shellvar","version_requirement":">= 1.2.0 <= 5.0.0"} + {"name":"puppetlabs/stdlib","version_requirement":">= 4.5.0 < 10.0.0"}, + {"name":"puppetlabs/concat","version_requirement":">= 1.1.2 < 10.0.0"}, + {"name":"puppetlabs/transition","version_requirement":">= 0.1.0 < 3.0.0"}, + {"name":"puppet/augeasproviders_core","version_requirement":">= 2.1.5 < 5.0.0"}, + {"name":"puppet/augeasproviders_shellvar","version_requirement":">= 1.2.0 <= 7.0.0"} ], "tags": ["nfs", "nfs4", "exports", "mount", "mfc"], "operatingsystem_support": [ From f453425b0ee7d994b6b2c07c7040663a772f400d Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Fri, 7 Jun 2024 12:04:19 +0200 Subject: [PATCH 23/30] update module dependencies --- metadata.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index b4bcf00e..750c6c5e 100644 --- a/metadata.json +++ b/metadata.json @@ -12,7 +12,9 @@ {"name":"puppetlabs/concat","version_requirement":">= 1.1.2 < 10.0.0"}, {"name":"puppetlabs/transition","version_requirement":">= 0.1.0 < 3.0.0"}, {"name":"puppet/augeasproviders_core","version_requirement":">= 2.1.5 < 5.0.0"}, - {"name":"puppet/augeasproviders_shellvar","version_requirement":">= 1.2.0 <= 7.0.0"} + {"name":"puppet/augeasproviders_shellvar","version_requirement":">= 1.2.0 <= 7.0.0"}, + {"name":"puppetlabs/augeas_core","version_requirement":">= 1.2.0 <= 2.0.0"}, + {"name":"puppetlabs/mount_core","version_requirement":">= 1.2.0 <= 2.0.0"} ], "tags": ["nfs", "nfs4", "exports", "mount", "mfc"], "operatingsystem_support": [ From ba2e4f831d62139fbc2e33cdf8b67606a44f932c Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Fri, 7 Jun 2024 13:15:40 +0200 Subject: [PATCH 24/30] add missing directories to acceptance test --- spec/acceptance/class_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb index 3c014676..52bd5bf9 100644 --- a/spec/acceptance/class_spec.rb +++ b/spec/acceptance/class_spec.rb @@ -105,7 +105,7 @@ class { '::nfs': describe 'include nfs with server params' do context 'when server params' do server_pp = <<-PUPPETCODE - file { ['/data_folder', '/homeexport']: + file { ['/export', '/export/data_folder', '/etxport/homeexport', '/data_folder', '/homeexport']: ensure => 'directory', } class { '::nfs': From e79827cf31bf8610e0d4e64c7c16f2d3b41b1262 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Fri, 7 Jun 2024 13:20:29 +0200 Subject: [PATCH 25/30] typo in dir name --- spec/acceptance/class_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb index 52bd5bf9..6eaa63db 100644 --- a/spec/acceptance/class_spec.rb +++ b/spec/acceptance/class_spec.rb @@ -105,7 +105,7 @@ class { '::nfs': describe 'include nfs with server params' do context 'when server params' do server_pp = <<-PUPPETCODE - file { ['/export', '/export/data_folder', '/etxport/homeexport', '/data_folder', '/homeexport']: + file { ['/export', '/export/data_folder', '/export/homeexport', '/data_folder', '/homeexport']: ensure => 'directory', } class { '::nfs': From f830987e5ae62584bd17e53742ac0ac1e9a45cd7 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Fri, 7 Jun 2024 14:16:57 +0200 Subject: [PATCH 26/30] nfs::server::export needs strict dependenc to nfs::server:servcie class --- metadata.json | 6 ------ spec/acceptance/class_spec.rb | 2 ++ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/metadata.json b/metadata.json index 750c6c5e..a483a441 100644 --- a/metadata.json +++ b/metadata.json @@ -56,12 +56,6 @@ "operatingsystemrelease": [ "13" ] - }, - { - "operatingsystem": "Archlinux", - "operatingsystemrelease": [ - "1.0" - ] } ], "requirements": [ diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb index 6eaa63db..dccf2621 100644 --- a/spec/acceptance/class_spec.rb +++ b/spec/acceptance/class_spec.rb @@ -118,11 +118,13 @@ class { '::nfs': nfs::server::export { '/data_folder': ensure => 'mounted', clients => '*(rw,insecure,async,no_root_squash,no_subtree_check)', + before => Class['nfs::server::service'], } nfs::server::export { '/homeexport': ensure => 'mounted', clients => '*(rw,insecure,async,root_squash,no_subtree_check)', mount => '/srv/home', + before => Class['nfs::server::service'], } PUPPETCODE From 137bfc979ae48a6449da740beaf2d3d57e3c9c7f Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Sat, 8 Jun 2024 15:10:46 +0200 Subject: [PATCH 27/30] adopt acceptance test to local tests --- spec/acceptance/class_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb index dccf2621..1dbe1f16 100644 --- a/spec/acceptance/class_spec.rb +++ b/spec/acceptance/class_spec.rb @@ -105,7 +105,7 @@ class { '::nfs': describe 'include nfs with server params' do context 'when server params' do server_pp = <<-PUPPETCODE - file { ['/export', '/export/data_folder', '/export/homeexport', '/data_folder', '/homeexport']: + file { ['/export', '/data_folder', '/homeexport']: ensure => 'directory', } class { '::nfs': From e8c8f9526948037772d33d3d102bff9be98d2ee4 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Sun, 9 Jun 2024 19:25:46 +0200 Subject: [PATCH 28/30] disable serverspec tests for services containers can not start the servcie due to missing kernel modules --- spec/acceptance/class_spec.rb | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb index 1dbe1f16..b46c82a4 100644 --- a/spec/acceptance/class_spec.rb +++ b/spec/acceptance/class_spec.rb @@ -89,9 +89,10 @@ class { '::nfs': end end - describe service(server_service) do - it { is_expected.not_to be_running } - end + puts 'server services can not be started due to container and kernel modules' + # describe service(server_service) do + # it { is_expected.not_to be_running } + # end server_packages_only = server_packages - client_packages server_packages_only.each do |package| @@ -146,9 +147,10 @@ class { '::nfs': if fact('os.distro.codename') == 'trusty' || fact('os.distro.codename') == 'wheezy' || (fact('os.family') == 'RedHat' && fact('os.release.major') == '6') puts 'Buggy nfs-kernel-server does not run in docker with Ubuntu 14.04, Debian wheezy and CentOs 6 images' else - describe service(server_service) do - it { is_expected.to be_running } - end + puts 'server services can not be started due to container and kernel modules' + # describe service(server_service) do + # it { is_expected.to be_running } + # end end if server_servicehelpers != '' @@ -157,9 +159,10 @@ class { '::nfs': if server_servicehelper == 'nfs-common' && fact('os.distro.codename') == 'wheezy' puts 'puppet reports wrong status for nfs-common on wheezy' else - describe service(server_servicehelper) do - it { is_expected.to be_running } - end + puts 'server services can not be started due to container and kernel modules' + # describe service(server_servicehelper) do + # it { is_expected.to be_running } + # end end end end From 8592a2fe344180603040076c1a0dd7675cb69ca0 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Sun, 9 Jun 2024 19:30:47 +0200 Subject: [PATCH 29/30] rubocop --- spec/acceptance/class_spec.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb index b46c82a4..156ad75b 100644 --- a/spec/acceptance/class_spec.rb +++ b/spec/acceptance/class_spec.rb @@ -8,19 +8,19 @@ when 'Debian' case fact('os.distro.codename') when 'jessie', 'wheezy' - server_service = 'nfs-kernel-server' + # server_service = 'nfs-kernel-server' server_servicehelpers = %w[nfs-common] client_services = %w[rpcbind nfs-common] when 'trusty' - server_service = 'nfs-kernel-server' + # server_service = 'nfs-kernel-server' server_servicehelpers = '' client_services = %w[rpcbind] - when 'bionic', 'focal' - server_service = 'nfs-kernel-server' - server_servicehelpers = %w[nfs-idmapd] - client_services = %w[rpcbind] + # when 'bionic', 'focal' + # server_service = 'nfs-kernel-server' + # server_servicehelpers = %w[nfs-idmapd] + # client_services = %w[rpcbind] else - server_service = 'nfs-server' + # server_service = 'nfs-server' server_servicehelpers = %w[nfs-idmapd] client_services = %w[rpcbind] end @@ -30,11 +30,11 @@ when 'RedHat' case fact('os.release.major') when '6' - server_service = 'nfs' + # server_service = 'nfs' server_servicehelpers = %w[rpcidmapd rpcbind] client_services = %w[rpcbind] when '7' - server_service = 'nfs-server.service' + # server_service = 'nfs-server.service' server_servicehelpers = %w[nfs-idmap.service] client_services = %w[rpcbind.service rpcbind.socket] end From 9a7607c39de516adae5f1e48f3596a38767a8d28 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Sun, 9 Jun 2024 22:37:18 +0200 Subject: [PATCH 30/30] remove unneeded files --- .rspec | 5 ----- .rspec_parallel | 4 ---- 2 files changed, 9 deletions(-) delete mode 100644 .rspec delete mode 100644 .rspec_parallel diff --git a/.rspec b/.rspec deleted file mode 100644 index f634583d..00000000 --- a/.rspec +++ /dev/null @@ -1,5 +0,0 @@ -# Managed by modulesync - DO NOT EDIT -# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ - ---format documentation ---color diff --git a/.rspec_parallel b/.rspec_parallel deleted file mode 100644 index a9a84f85..00000000 --- a/.rspec_parallel +++ /dev/null @@ -1,4 +0,0 @@ -# Managed by modulesync - DO NOT EDIT -# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ - ---format progress