Skip to content

Commit

Permalink
More lints and Puppet8 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
alvagante committed Oct 22, 2023
1 parent c6d7f58 commit e681247
Show file tree
Hide file tree
Showing 15 changed files with 32 additions and 34 deletions.
2 changes: 1 addition & 1 deletion manifests/git/clone.pp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
exec { "git_clone sync ${title}":
command => $clone_sync,
refreshonly => true,
path => $facts['path'], # This is the fact $::path
path => $facts['path'], # This is the fact $facts['path']
subscribe => [Tp::Dir["git_clone ${title}"], Exec["git_sync ${title}"]],
user => $owner,
}
Expand Down
8 changes: 4 additions & 4 deletions manifests/netinstall.pp
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@
Stdlib::Filemode $timeout = '3600',
Stdlib::Absolutepath $work_dir = '/var/tmp',
String $path = '/bin:/sbin:/usr/bin:/usr/sbin',
String $extract_command = '', # lint:ignore:params_empty_string_assignment
String $preextract_command = '', # lint:ignore:params_empty_string_assignment
String $postextract_command = '', # lint:ignore:params_empty_string_assignment
Variant[String,Boolean] $extract_command = '', # lint:ignore:params_empty_string_assignment
Variant[String,Boolean] $preextract_command = '', # lint:ignore:params_empty_string_assignment
Variant[String,Boolean] $postextract_command = '', # lint:ignore:params_empty_string_assignment
Optional[Stdlib::Absolutepath] $postextract_cwd = undef,
Array $exec_env = [],
Optional[Stdlib::Absolutepath] $creates = undef,
Expand Down Expand Up @@ -136,7 +136,7 @@
environment => $exec_env,
}

if $extract_command {
if $real_extract_command and $real_extract_command != '' {
exec { "Extract ${source_filename} from ${work_dir} - ${title}":
command => "mkdir -p ${destination_dir} && cd ${destination_dir} && ${real_extract_command} ${work_dir}/${source_filename} ${extract_command_second_arg}", # lint:ignore:140chars
unless => "ls ${destination_dir}/${real_extracted_dir}",
Expand Down
12 changes: 5 additions & 7 deletions manifests/network/interface.pp
Original file line number Diff line number Diff line change
Expand Up @@ -298,14 +298,12 @@
'SLES', 'OpenSuSE': {
# Prerequisites
if $manage_prerequisites
and is_hash($extra_settings) {
if 'VLAN_ID' in $extra_settings
and !defined(Package['vlan']) {
package { 'vlan':
ensure => 'present',
}
Package['vlan'] -> File[$config_file_path]
and 'VLAN_ID' in $extra_settings
and !defined(Package['vlan']) {
package { 'vlan':
ensure => 'present',
}
Package['vlan'] -> File[$config_file_path]
}
if $manage_prerequisites
and 'BRIDGE' in $settings
Expand Down
2 changes: 1 addition & 1 deletion manifests/puppet/autosign.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class psick::puppet::autosign (
Enum['on', 'off', 'policy_based'] $autosign = 'policy_based',
Optional[String] $autosign_match = undef,
Optional[Array] $policy_based_psk = ['123456'],
Optional[Array] $policy_based_psk = undef,
Boolean $manage = $psick::manage,
Boolean $noop_manage = $psick::noop_manage,
Boolean $noop_value = $psick::noop_value,
Expand Down
2 changes: 1 addition & 1 deletion manifests/puppet/pe_client_tools.pp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

# Madness will be
$pe_patch = $pe_short_version ? {
'21.5.0' => $::kernel ? {
'21.5.0' => $facts['kernel'] ? {
'windows' => '',
default => '-1',
},
Expand Down
10 changes: 5 additions & 5 deletions manifests/puppet/pe_code_manager.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
Optional[String] $deploy_ssh_public_source = undef,
Optional[String] $pe_user = undef,
Optional[String] $pe_password = undef,
Optional[String] $pe_email = 'root@localhost',
String $pe_email = 'root@localhost',
Optional[String] $deploy_comment = undef,
Optional[String] $deploy_user = 'root',
Optional[String] $puppet_user = 'pe-puppet',
Optional[String] $puppet_group = 'pe-puppet',
String $deploy_user = 'root',
String $puppet_user = 'pe-puppet',
String $puppet_group = 'pe-puppet',
Optional[String] $puppet_user_home = undef,
Optional[String] $lifetime = '5y',
String $lifetime = '5y',
Boolean $manage = $psick::manage,
Boolean $noop_manage = $psick::noop_manage,
Boolean $noop_value = $psick::noop_value,
Expand Down
2 changes: 1 addition & 1 deletion manifests/puppet/set_external_fact.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
fail('You must specify either a value or a template to use')
}

$external_facts_dir = $::kernel ? {
$external_facts_dir = $facts['kernel'] ? {
'Windows' => 'C:\ProgramData\PuppetLabs\facter\facts.d',
default => '/etc/puppetlabs/facter/facts.d',
}
Expand Down
2 changes: 1 addition & 1 deletion manifests/python/fabric.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This class installs fabric
#
class psick::python::fabric (
$ensure = 'present',
String $ensure = 'present',

Boolean $manage = $psick::manage,
Boolean $noop_manage = $psick::noop_manage,
Expand Down
2 changes: 1 addition & 1 deletion manifests/python/pip.pp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
class psick::python::pip (
$ensure = 'present',
String $ensure = 'present',

Boolean $manage = $psick::manage,
Boolean $noop_manage = $psick::noop_manage,
Expand Down
2 changes: 1 addition & 1 deletion manifests/ruby.pp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
class psick::ruby (
$ensure = 'present',
String $ensure = 'present',

Boolean $manage = $psick::manage,
Boolean $noop_manage = $psick::noop_manage,
Expand Down
2 changes: 1 addition & 1 deletion manifests/ruby/bundler.pp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
class psick::ruby::bundler (
$ensure = 'present',
String $ensure = 'present',

Boolean $manage = $psick::manage,
Boolean $noop_manage = $psick::noop_manage,
Expand Down
8 changes: 4 additions & 4 deletions manifests/ruby/rbenv.pp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
Variant[Boolean,String] $ensure = present,
Enum['jdowning'] $module = 'jdowning',

Optional[String] $default_ruby_version = '2.4.2',
Optional[String] $default_ruby_version = undef,
Optional[String] $install_dir = undef,
Optional[String] $owner = undef,
Optional[String] $group = undef,
Expand Down Expand Up @@ -63,9 +63,9 @@
group => $group,
latest => $latest,
}
$default_gem_options = {
ruby_version => $default_ruby_version,
}
$default_gem_options = delete_undef_values({
ruby_version => $default_ruby_version,
})
if $default_ruby_version and $auto_prereq {
rbenv::plugin { 'rbenv/ruby-build': }
rbenv::build { $default_ruby_version:
Expand Down
2 changes: 1 addition & 1 deletion manifests/selinux.pp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@

exec { 'psick_selinux_setenforce':
command => "setenforce ${setenforce_status}",
path => $::path,
path => $facts['path'],
refreshonly => true,
}

Expand Down
6 changes: 3 additions & 3 deletions manifests/services.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# This class provides a wrapper for psick services defines
#
class psick::services (
Optional[Hash] $init_scripts = {},
Optional[Hash] $systemd_scripts = {},
Hash $init_scripts = {},
Hash $systemd_scripts = {},

Boolean $manage = $psick::manage,
Boolean $noop_manage = $psick::noop_manage,
Expand All @@ -14,7 +14,7 @@
if $noop_manage {
noop($noop_value)
}
if $::kernel == 'Linux' {
if $facts['kernel'] == 'Linux' {
$init_scripts.each |$k,$v| {
psick::services::init_script { $k:
* => $v,
Expand Down
4 changes: 2 additions & 2 deletions manifests/services/systemd_script.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
Optional[String] $content = undef,
Optional[String] $template = undef,
Optional[String] $epp = undef,
Optional[String] $path = "/usr/local/sbin/${title}",
String $path = "/usr/local/sbin/${title}",
Optional[String] $service_ensure = undef,
Variant[Undef,Boolean,String] $service_enable = undef,
String $systemd_template = 'psick/services/systemd.erb',
Optional[String] $systemd_after = 'network.target',
Optional[String] $systemd_after = 'network.target', # lint:ignore:optional_default
Optional[String] $systemd_before = undef,
) {
$manage_content = tp_content($content, $template, $epp)
Expand Down

0 comments on commit e681247

Please sign in to comment.