Skip to content

Commit

Permalink
Puppet lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ekohl authored and mmoll committed Apr 14, 2020
1 parent 4302973 commit 8b9a9f3
Show file tree
Hide file tree
Showing 14 changed files with 397 additions and 399 deletions.
46 changes: 23 additions & 23 deletions manifests/agent/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,67 +2,67 @@
# @api private
class puppet::agent::config inherits puppet::config {
puppet::config::agent{
'classfile': value => $::puppet::classfile;
'classfile': value => $puppet::classfile;
'localconfig': value => '$vardir/localconfig';
'default_schedules': value => false;
'report': value => $::puppet::report;
'masterport': value => $::puppet::port;
'environment': value => $::puppet::environment;
'splay': value => $::puppet::splay;
'splaylimit': value => $::puppet::splaylimit;
'runinterval': value => $::puppet::runinterval;
'noop': value => $::puppet::agent_noop;
'usecacheonfailure': value => $::puppet::usecacheonfailure;
'report': value => $puppet::report;
'masterport': value => $puppet::port;
'environment': value => $puppet::environment;
'splay': value => $puppet::splay;
'splaylimit': value => $puppet::splaylimit;
'runinterval': value => $puppet::runinterval;
'noop': value => $puppet::agent_noop;
'usecacheonfailure': value => $puppet::usecacheonfailure;
}
if $::puppet::http_connect_timeout != undef {
if $puppet::http_connect_timeout != undef {
puppet::config::agent {
'http_connect_timeout': value => $::puppet::http_connect_timeout;
'http_connect_timeout': value => $puppet::http_connect_timeout;
}
}
if $::puppet::http_read_timeout != undef {
if $puppet::http_read_timeout != undef {
puppet::config::agent {
'http_read_timeout': value => $::puppet::http_read_timeout;
'http_read_timeout': value => $puppet::http_read_timeout;
}
}
if $::puppet::prerun_command {
if $puppet::prerun_command {
puppet::config::agent {
'prerun_command': value => $::puppet::prerun_command;
'prerun_command': value => $puppet::prerun_command;
}
}
if $::puppet::postrun_command {
if $puppet::postrun_command {
puppet::config::agent {
'postrun_command': value => $::puppet::postrun_command;
'postrun_command': value => $puppet::postrun_command;
}
}

unless $::puppet::pluginsync {
unless $puppet::pluginsync {
if versioncmp($facts['puppetserver'], '6.0.0') >= 0 {
fail('pluginsync is no longer a setting in Puppet 6')
} else {
puppet::config::agent { 'pluginsync':
value => $::puppet::pluginsync,
value => $puppet::pluginsync,
}
}
}

$::puppet::agent_additional_settings.each |$key,$value| {
$puppet::agent_additional_settings.each |$key,$value| {
puppet::config::agent { $key: value => $value }
}

if $::puppet::runmode == 'service' {
if $puppet::runmode == 'service' {
$should_start = 'yes'
} else {
$should_start = 'no'
}

if $::osfamily == 'Debian' {
if $facts['os']['family'] == 'Debian' {
augeas {'puppet::set_start':
context => '/files/etc/default/puppet',
changes => "set START ${should_start}",
incl => '/etc/default/puppet',
lens => 'Shellvars.lns',
}
if $::puppet::remove_lock {
if $puppet::remove_lock {
file {'/var/lib/puppet/state/agent_disabled.lock':
ensure => absent,
}
Expand Down
10 changes: 5 additions & 5 deletions manifests/agent/install.pp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Install the puppet agent package
# @api private
class puppet::agent::install(
$manage_packages = $::puppet::manage_packages,
$package_name = $::puppet::client_package,
$package_version = $::puppet::version,
$package_provider = $::puppet::package_provider,
$package_source = $::puppet::package_source,
$manage_packages = $puppet::manage_packages,
$package_name = $puppet::client_package,
$package_version = $puppet::version,
$package_provider = $puppet::package_provider,
$package_source = $puppet::package_source,
) {
if $manage_packages == true or $manage_packages == 'agent' {
package { $package_name:
Expand Down
12 changes: 6 additions & 6 deletions manifests/agent/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# @api private
class puppet::agent::service {

case $::puppet::runmode {
case $puppet::runmode {
'service': {
$service_enabled = true
$cron_enabled = false
Expand All @@ -28,7 +28,7 @@
}
}

if $::puppet::runmode in $::puppet::unavailable_runmodes {
if $puppet::runmode in $puppet::unavailable_runmodes {
fail("Runmode of ${puppet::runmode} not supported on ${::kernel} operating systems!")
}

Expand All @@ -39,15 +39,15 @@

class { 'puppet::agent::service::systemd':
enabled => $systemd_enabled,
hour => $::puppet::run_hour,
minute => $::puppet::run_minute,
hour => $puppet::run_hour,
minute => $puppet::run_minute,
}
contain puppet::agent::service::systemd

class { 'puppet::agent::service::cron':
enabled => $cron_enabled,
hour => $::puppet::run_hour,
minute => $::puppet::run_minute,
hour => $puppet::run_hour,
minute => $puppet::run_minute,
}
contain puppet::agent::service::cron
}
6 changes: 3 additions & 3 deletions manifests/agent/service/cron.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
Optional[Integer[0,23]] $hour = undef,
Optional[Integer[0,59]] $minute = undef,
) {
unless $::puppet::runmode == 'unmanaged' or 'cron' in $::puppet::unavailable_runmodes {
unless $puppet::runmode == 'unmanaged' or 'cron' in $puppet::unavailable_runmodes {
if $enabled {
$command = pick($::puppet::cron_cmd, "${::puppet::puppet_cmd} agent --config ${::puppet::dir}/puppet.conf --onetime --no-daemonize")
$times = extlib::ip_to_cron($::puppet::runinterval)
$command = pick($puppet::cron_cmd, "${puppet::puppet_cmd} agent --config ${puppet::dir}/puppet.conf --onetime --no-daemonize")
$times = extlib::ip_to_cron($puppet::runinterval)

$_hour = pick($hour, $times[0])
$_minute = pick($minute, $times[1])
Expand Down
2 changes: 1 addition & 1 deletion manifests/agent/service/daemon.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class puppet::agent::service::daemon (
Boolean $enabled = false,
) {
unless $::puppet::runmode == 'unmanaged' or 'service' in $::puppet::unavailable_runmodes {
unless $puppet::runmode == 'unmanaged' or 'service' in $puppet::unavailable_runmodes {
if $enabled {
service {'puppet':
ensure => running,
Expand Down
54 changes: 27 additions & 27 deletions manifests/config.pp
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
# Set up the puppet config
# @api private
class puppet::config(
$allow_any_crl_auth = $::puppet::allow_any_crl_auth,
$auth_allowed = $::puppet::auth_allowed,
$auth_template = $::puppet::auth_template,
$ca_server = $::puppet::ca_server,
$ca_port = $::puppet::ca_port,
$dns_alt_names = $::puppet::dns_alt_names,
$module_repository = $::puppet::module_repository,
$pluginsource = $::puppet::pluginsource,
$pluginfactsource = $::puppet::pluginfactsource,
$puppet_dir = $::puppet::dir,
$puppetmaster = $::puppet::puppetmaster,
$syslogfacility = $::puppet::syslogfacility,
$srv_domain = $::puppet::srv_domain,
$use_srv_records = $::puppet::use_srv_records,
$additional_settings = $::puppet::additional_settings,
$client_certname = $::puppet::client_certname,
$allow_any_crl_auth = $puppet::allow_any_crl_auth,
$auth_allowed = $puppet::auth_allowed,
$auth_template = $puppet::auth_template,
$ca_server = $puppet::ca_server,
$ca_port = $puppet::ca_port,
$dns_alt_names = $puppet::dns_alt_names,
$module_repository = $puppet::module_repository,
$pluginsource = $puppet::pluginsource,
$pluginfactsource = $puppet::pluginfactsource,
$puppet_dir = $puppet::dir,
$puppetmaster = $puppet::puppetmaster,
$syslogfacility = $puppet::syslogfacility,
$srv_domain = $puppet::srv_domain,
$use_srv_records = $puppet::use_srv_records,
$additional_settings = $puppet::additional_settings,
$client_certname = $puppet::client_certname,
) {
puppet::config::main{
'vardir': value => $::puppet::vardir;
'logdir': value => $::puppet::logdir;
'rundir': value => $::puppet::rundir;
'ssldir': value => $::puppet::ssldir;
'vardir': value => $puppet::vardir;
'logdir': value => $puppet::logdir;
'rundir': value => $puppet::rundir;
'ssldir': value => $puppet::ssldir;
'privatekeydir': value => '$ssldir/private_keys { group = service }';
'hostprivkey': value => '$privatekeydir/$certname.pem { mode = 640 }';
'show_diff': value => $::puppet::show_diff;
'codedir': value => $::puppet::codedir;
'show_diff': value => $puppet::show_diff;
'codedir': value => $puppet::codedir;
}

if $module_repository and !empty($module_repository) {
Expand All @@ -51,7 +51,7 @@
}
} else {
puppet::config::main {
'server': value => pick($puppetmaster, $::fqdn);
'server': value => pick($puppetmaster, $facts['networking']['fqdn']);
}
}
if $pluginsource {
Expand All @@ -75,10 +75,10 @@

file { $puppet_dir:
ensure => directory,
owner => $::puppet::dir_owner,
group => $::puppet::dir_group,
owner => $puppet::dir_owner,
group => $puppet::dir_group,
}
-> case $::osfamily {
-> case $facts['os']['family'] {
'Windows': {
concat { "${puppet_dir}/puppet.conf":
mode => '0674',
Expand All @@ -89,7 +89,7 @@
default: {
concat { "${puppet_dir}/puppet.conf":
owner => 'root',
group => $::puppet::params::root_group,
group => $puppet::params::root_group,
mode => '0644',
ensure_newline => true,
}
Expand Down
6 changes: 3 additions & 3 deletions manifests/config/entry.pp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# note the spaces at he end of the 'order' parameters,
# they make sure that '1_main ' is ordered before '1_main_*'
ensure_resource('concat::fragment', "puppet.conf_${section}", {
target => "${::puppet::dir}/puppet.conf",
target => "${puppet::dir}/puppet.conf",
content => "\n[${section}]",
order => "${sectionorder}_${section} ",
})
Expand All @@ -38,13 +38,13 @@
# otherwise it just appends it with the joiner to separate it from the previous value.
if (!defined(Concat::Fragment["puppet.conf_${section}_${key}"])){
concat::fragment{"puppet.conf_${section}_${key}":
target => "${::puppet::dir}/puppet.conf",
target => "${puppet::dir}/puppet.conf",
content => " ${key} = ${_value}",
order => "${sectionorder}_${section}_${key} ",
}
} else {
concat::fragment{"puppet.conf_${section}_${key}_${name}":
target => "${::puppet::dir}/puppet.conf",
target => "${puppet::dir}/puppet.conf",
content => "${joiner}${_value}",
order => "${sectionorder}_${section}_${key}_${name} ",
}
Expand Down
14 changes: 7 additions & 7 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -704,13 +704,13 @@
Integer[0] $server_web_idle_timeout = $puppet::params::server_web_idle_timeout,
Boolean $server_puppetserver_jruby9k = $puppet::params::server_puppetserver_jruby9k,
Optional[Boolean] $server_puppetserver_metrics = $puppet::params::server_puppetserver_metrics,
Boolean $server_metrics_jmx_enable = $::puppet::params::server_metrics_jmx_enable,
Boolean $server_metrics_graphite_enable = $::puppet::params::server_metrics_graphite_enable,
String $server_metrics_graphite_host = $::puppet::params::server_metrics_graphite_host,
Integer $server_metrics_graphite_port = $::puppet::params::server_metrics_graphite_port,
String $server_metrics_server_id = $::puppet::params::server_metrics_server_id,
Integer $server_metrics_graphite_interval = $::puppet::params::server_metrics_graphite_interval,
Optional[Array] $server_metrics_allowed = $::puppet::params::server_metrics_allowed,
Boolean $server_metrics_jmx_enable = $puppet::params::server_metrics_jmx_enable,
Boolean $server_metrics_graphite_enable = $puppet::params::server_metrics_graphite_enable,
String $server_metrics_graphite_host = $puppet::params::server_metrics_graphite_host,
Integer $server_metrics_graphite_port = $puppet::params::server_metrics_graphite_port,
String $server_metrics_server_id = $puppet::params::server_metrics_server_id,
Integer $server_metrics_graphite_interval = $puppet::params::server_metrics_graphite_interval,
Optional[Array] $server_metrics_allowed = $puppet::params::server_metrics_allowed,
Boolean $server_puppetserver_experimental = $puppet::params::server_puppetserver_experimental,
Array[String] $server_puppetserver_trusted_agents = $puppet::params::server_puppetserver_trusted_agents,
Optional[Enum['off', 'jit', 'force']] $server_compile_mode = $puppet::params::server_compile_mode,
Expand Down
Loading

0 comments on commit 8b9a9f3

Please sign in to comment.