Skip to content

Commit

Permalink
Merge pull request #191 from tuxmea/lint_fix
Browse files Browse the repository at this point in the history
lint auto fix
  • Loading branch information
tuxmea authored Jun 10, 2024
2 parents 4b11e94 + 955ee22 commit 3310232
Show file tree
Hide file tree
Showing 14 changed files with 284 additions and 326 deletions.
13 changes: 6 additions & 7 deletions manifests/client.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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': }

Check warning on line 24 in manifests/client.pp

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

manifest includes anchor resource (check: anchor_resource)

Check warning on line 24 in manifests/client.pp

View workflow job for this annotation

GitHub Actions / Static code analysis (7.22.0, 3.1.3)

manifest includes anchor resource (check: anchor_resource)

Check warning on line 24 in manifests/client.pp

View workflow job for this annotation

GitHub Actions / Static code analysis (7.22.0, 3.0.5)

manifest includes anchor resource (check: anchor_resource)

Check warning on line 24 in manifests/client.pp

View workflow job for this annotation

GitHub Actions / Static code analysis (7.22.0, 2.7.7)

manifest includes anchor resource (check: anchor_resource)
anchor { 'nfs::client::end': }

Check warning on line 25 in manifests/client.pp

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

manifest includes anchor resource (check: anchor_resource)

Check warning on line 25 in manifests/client.pp

View workflow job for this annotation

GitHub Actions / Static code analysis (7.22.0, 3.1.3)

manifest includes anchor resource (check: anchor_resource)

Check warning on line 25 in manifests/client.pp

View workflow job for this annotation

GitHub Actions / Static code analysis (7.22.0, 3.0.5)

manifest includes anchor resource (check: anchor_resource)

Check warning on line 25 in manifests/client.pp

View workflow job for this annotation

GitHub Actions / Static code analysis (7.22.0, 2.7.7)

manifest includes anchor resource (check: anchor_resource)

# package(s)
class { 'nfs::client::package': }
Expand Down
64 changes: 30 additions & 34 deletions manifests/client/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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,
}
}
Expand Down
23 changes: 9 additions & 14 deletions manifests/client/mount.pp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
# String. Overwrite mount root if differs from server config
#


# === Examples
#
# class { '::nfs':
Expand Down Expand Up @@ -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 {
Expand All @@ -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,
Expand All @@ -131,9 +128,7 @@
mount_name => $bindmount,
}
}

} else {

if $share != undef {
$sharename = $share
} else {
Expand All @@ -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,
Expand Down
25 changes: 9 additions & 16 deletions manifests/client/package.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}

}
}
45 changes: 20 additions & 25 deletions manifests/client/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
2 changes: 1 addition & 1 deletion manifests/functions/create_export.pp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
$line = "${name} ${join(any2array($clients),' ')}\n"

concat::fragment { $name:
target => $::nfs::exports_file,
target => $nfs::exports_file,
content => $line,
}

Expand Down
2 changes: 1 addition & 1 deletion manifests/functions/mkdir.pp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#

define nfs::functions::mkdir (
$ensure = 'present',
$ensure = 'present',
) {
if $ensure != 'absent' {
exec { "mkdir_recurse_${name}":
Expand Down
Loading

0 comments on commit 3310232

Please sign in to comment.