Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to voxpupuli-test 5 #841

Merged
merged 5 commits into from
Jan 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ gem 'puppet-lint-param-docs', '>= 1.3.0', {"groups"=>["test"]}
gem 'puppet-lint-spaceship_operator_without_tag-check', {"groups"=>["test"]}
gem 'puppet-lint-strict_indent-check', {"groups"=>["test"]}
gem 'puppet-lint-undef_in_function-check', {"groups"=>["test"]}
gem 'voxpupuli-test', '~> 1.4', {"groups"=>["test"]}
gem 'voxpupuli-test', '~> 5.0', {"groups"=>["test"]}
gem 'github_changelog_generator', '>= 1.15.0', {"groups"=>["development"]}
gem 'puppet_metadata', '~> 1.3'
gem 'puppet-blacksmith', '>= 6.0.0', {"groups"=>["development"]}
Expand Down
2 changes: 1 addition & 1 deletion manifests/agent/config.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Puppet agent configuration
# @api private
class puppet::agent::config inherits puppet::config {
puppet::config::agent{
puppet::config::agent {
'classfile': value => $puppet::classfile;
'localconfig': value => '$vardir/localconfig';
'default_schedules': value => false;
Expand Down
14 changes: 7 additions & 7 deletions manifests/agent/install.pp
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# 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_install_options = $puppet::package_install_options,
$package_source = $puppet::package_source,
class puppet::agent::install (
Variant[Boolean, Enum['server', 'agent']] $manage_packages = $puppet::manage_packages,
Variant[String, Array[String]] $package_name = $puppet::client_package,
String[1] $package_version = $puppet::version,
Optional[String[1]] $package_provider = $puppet::package_provider,
Variant[Undef, String, Hash, Array] $package_install_options = $puppet::package_install_options,
Variant[Undef, Stdlib::Absolutepath, Stdlib::HTTPUrl] $package_source = $puppet::package_source,
) {
if $manage_packages == true or $manage_packages == 'agent' {
package { $package_name:
Expand Down
3 changes: 1 addition & 2 deletions manifests/agent/service.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Set up the puppet agent as a service
# @api private
class puppet::agent::service {

case $puppet::runmode {
'service': {
$service_enabled = true
Expand Down Expand Up @@ -29,7 +28,7 @@
}

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

class { 'puppet::agent::service::daemon':
Expand Down
2 changes: 1 addition & 1 deletion manifests/agent/service/cron.pp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
hour => $_hour,
minute => $_minute,
}
} else{
} else {
cron { 'puppet':
ensure => absent,
}
Expand Down
4 changes: 2 additions & 2 deletions manifests/agent/service/daemon.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
) {
unless $puppet::runmode == 'unmanaged' or 'service' in $puppet::unavailable_runmodes {
if $enabled {
service {'puppet':
service { 'puppet':
ensure => running,
name => $puppet::service_name,
hasstatus => true,
Expand All @@ -14,7 +14,7 @@
restart => $puppet::agent_restart_command,
}
} else {
service {'puppet':
service { 'puppet':
ensure => stopped,
name => $puppet::service_name,
hasstatus => true,
Expand Down
24 changes: 13 additions & 11 deletions manifests/config.pp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Set up the puppet config
# @api private
class puppet::config(
class puppet::config (
# lint:ignore:parameter_types
$allow_any_crl_auth = $puppet::allow_any_crl_auth,
$auth_allowed = $puppet::auth_allowed,
$auth_template = $puppet::auth_template,
Expand All @@ -17,8 +18,9 @@
$use_srv_records = $puppet::use_srv_records,
$additional_settings = $puppet::additional_settings,
$client_certname = $puppet::client_certname,
# lint:endignore
) {
puppet::config::main{
puppet::config::main {
'vardir': value => $puppet::vardir;
'logdir': value => $puppet::logdir;
'rundir': value => $puppet::rundir;
Expand All @@ -30,22 +32,22 @@
}

if $module_repository and !empty($module_repository) {
puppet::config::main{'module_repository': value => $module_repository; }
puppet::config::main { 'module_repository': value => $module_repository; }
}
if $ca_server and !empty($ca_server) {
puppet::config::main{'ca_server': value => $ca_server; }
puppet::config::main { 'ca_server': value => $ca_server; }
}
if $ca_port {
puppet::config::main{'ca_port': value => $ca_port; }
puppet::config::main { 'ca_port': value => $ca_port; }
}
if $dns_alt_names and !empty($dns_alt_names) {
puppet::config::main{'dns_alt_names': value => $dns_alt_names; }
puppet::config::main { 'dns_alt_names': value => $dns_alt_names; }
}
if $use_srv_records {
unless $srv_domain {
fail('$::domain fact found to be undefined and $srv_domain is undefined')
fail('domain fact found to be undefined and $srv_domain is undefined')
}
puppet::config::main{
puppet::config::main {
'use_srv_records': value => true;
'srv_domain': value => $srv_domain;
}
Expand All @@ -55,13 +57,13 @@
}
}
if $pluginsource {
puppet::config::main{'pluginsource': value => $pluginsource; }
puppet::config::main { 'pluginsource': value => $pluginsource; }
}
if $pluginfactsource {
puppet::config::main{'pluginfactsource': value => $pluginfactsource; }
puppet::config::main { 'pluginfactsource': value => $pluginfactsource; }
}
if $syslogfacility and !empty($syslogfacility) {
puppet::config::main{'syslogfacility': value => $syslogfacility; }
puppet::config::main { 'syslogfacility': value => $syslogfacility; }
}
if $client_certname {
puppet::config::main {
Expand Down
2 changes: 1 addition & 1 deletion manifests/config/agent.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
String $key = $name,
String $joiner = ','
) {
puppet::config::entry{"agent_${name}":
puppet::config::entry { "agent_${name}":
key => $key,
value => $value,
joiner => $joiner,
Expand Down
6 changes: 3 additions & 3 deletions manifests/config/entry.pp
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@

# this adds the '$key =' for the first value,
# 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}":
if (!defined(Concat::Fragment["puppet.conf_${section}_${key}"])) {
concat::fragment { "puppet.conf_${section}_${key}":
target => "${puppet::dir}/puppet.conf",
content => "\n ${key} = ${_value}",
order => "${sectionorder}_${section}_${key} ",
}
} else {
concat::fragment{"puppet.conf_${section}_${key}_${name}":
concat::fragment { "puppet.conf_${section}_${key}_${name}":
target => "${puppet::dir}/puppet.conf",
content => "${joiner}${_value}",
order => "${sectionorder}_${section}_${key}_${name} ",
Expand Down
2 changes: 1 addition & 1 deletion manifests/config/main.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
String $key = $name,
String $joiner = ','
) {
puppet::config::entry{"main${name}":
puppet::config::entry { "main${name}":
key => $key,
value => $value,
joiner => $joiner,
Expand Down
2 changes: 1 addition & 1 deletion manifests/config/master.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
String $key = $name,
String $joiner = ','
) {
puppet::config::entry{"master_${name}":
puppet::config::entry { "master_${name}":
key => $key,
value => $value,
joiner => $joiner,
Expand Down
8 changes: 4 additions & 4 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@
Optional[String] $package_provider = $puppet::params::package_provider,
Optional[Variant[String,Hash,Array]] $package_install_options = $puppet::params::package_install_options,
Optional[Variant[Stdlib::Absolutepath, Stdlib::HTTPUrl]] $package_source = $puppet::params::package_source,
Integer[0, 65535] $port = $puppet::params::port,
Stdlib::Port $port = $puppet::params::port,
Boolean $splay = $puppet::params::splay,
Variant[Integer[0],Pattern[/^\d+[smhdy]?$/]] $splaylimit = $puppet::params::splaylimit,
Variant[Boolean, Stdlib::Absolutepath] $autosign = $puppet::params::autosign,
Expand All @@ -605,7 +605,7 @@
Optional[Integer[0]] $http_connect_timeout = $puppet::params::http_connect_timeout,
Optional[Integer[0]] $http_read_timeout = $puppet::params::http_read_timeout,
Optional[Variant[String, Boolean]] $ca_server = $puppet::params::ca_server,
Optional[Integer[0, 65535]] $ca_port = $puppet::params::ca_port,
Optional[Stdlib::Port] $ca_port = $puppet::params::ca_port,
Optional[String] $ca_crl_filepath = $puppet::params::ca_crl_filepath,
Optional[String] $prerun_command = $puppet::params::prerun_command,
Optional[String] $postrun_command = $puppet::params::postrun_command,
Expand Down Expand Up @@ -638,7 +638,7 @@
String $server_group = $puppet::params::group,
String $server_dir = $puppet::params::dir,
String $server_ip = $puppet::params::ip,
Integer $server_port = $puppet::params::port,
Stdlib::Port $server_port = $puppet::params::port,
Boolean $server_ca = $puppet::params::server_ca,
Boolean $server_ca_crl_sync = $puppet::params::server_ca_crl_sync,
Optional[Boolean] $server_crl_enable = $puppet::params::server_crl_enable,
Expand All @@ -647,7 +647,7 @@
Array[String] $server_ca_client_whitelist = $puppet::params::server_ca_client_whitelist,
Optional[Puppet::Custom_trusted_oid_mapping] $server_custom_trusted_oid_mapping = $puppet::params::server_custom_trusted_oid_mapping,
Boolean $server_http = $puppet::params::server_http,
Integer $server_http_port = $puppet::params::server_http_port,
Stdlib::Port $server_http_port = $puppet::params::server_http_port,
String $server_reports = $puppet::params::server_reports,
Optional[Stdlib::Absolutepath] $server_puppetserver_dir = $puppet::params::server_puppetserver_dir,
Optional[Stdlib::Absolutepath] $server_puppetserver_vardir = $puppet::params::server_puppetserver_vardir,
Expand Down
28 changes: 10 additions & 18 deletions manifests/params.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Default parameters
# @api private
class puppet::params {

# Basic config
$version = 'present'
$manage_user = true
Expand Down Expand Up @@ -34,19 +33,15 @@
$dns_alt_names = []
$use_srv_records = false

if defined('$::domain') {
$srv_domain = $facts['networking']['domain']
} else {
$srv_domain = undef
}
$srv_domain = fact('networking.domain')

# lint:ignore:puppet_url_without_modules
$pluginsource = 'puppet:///plugins'
$pluginfactsource = 'puppet:///pluginfacts'
# lint:endignore
$classfile = '$statedir/classes.txt'
$syslogfacility = undef
$environment = $::environment
$environment = $server_facts['environment']
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While https://www.puppet.com/docs/puppet/7/lang_facts_builtin_variables.html#lang_facts_builtin_variables-server-facts doesn't mention it, $server_facts['environment'] is present when using puppet apply.


# aio_agent_version is a core fact that's empty on non-AIO
$aio_package = fact('aio_agent_version') =~ String[1]
Expand Down Expand Up @@ -199,13 +194,10 @@

# Will this host be a puppet agent ?
$agent = true
$client_certname = $::clientcert
$client_certname = $trusted['certname']
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also present when using puppet apply


if defined('$::puppetmaster') {
$puppetmaster = $::puppetmaster
} else {
$puppetmaster = undef
}
# Set by the Foreman ENC
$puppetmaster = getvar('puppetmaster')

# Hashes containing additional settings
$additional_settings = {}
Expand All @@ -220,7 +212,7 @@
$server_external_nodes = "${dir}/node.rb"
$server_trusted_external_command = undef
$server_request_timeout = 60
$server_certname = $::clientcert
$server_certname = $trusted['certname']
$server_strict_variables = false
$server_http = false
$server_http_port = 8139
Expand Down Expand Up @@ -262,7 +254,7 @@

$server_storeconfigs = false

$puppet_major = regsubst($::puppetversion, '^(\d+)\..*$', '\1')
$puppet_major = regsubst($facts['puppetversion'], '^(\d+)\..*$', '\1')

if ($facts['os']['family'] =~ /(FreeBSD|DragonFly)/) {
$server_package = "puppetserver${puppet_major}"
Expand Down Expand Up @@ -377,8 +369,8 @@
$server_connect_timeout = 120000
$server_ca_auth_required = true
$server_ca_client_self_delete = false
$server_admin_api_whitelist = [ 'localhost', $lower_fqdn ]
$server_ca_client_whitelist = [ 'localhost', $lower_fqdn ]
$server_admin_api_whitelist = ['localhost', $lower_fqdn]
$server_ca_client_whitelist = ['localhost', $lower_fqdn]
$server_cipher_suites = [
'TLS_DHE_RSA_WITH_AES_128_GCM_SHA256',
'TLS_DHE_RSA_WITH_AES_256_GCM_SHA384',
Expand All @@ -387,7 +379,7 @@
'TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256',
'TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384',
]
$server_ssl_protocols = [ 'TLSv1.2' ]
$server_ssl_protocols = ['TLSv1.2']
$server_ssl_chain_filepath = undef
$server_check_for_updates = true
$server_environment_class_cache_enabled = false
Expand Down
8 changes: 4 additions & 4 deletions manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@
#
# $jolokia_metrics_whitelist:: The whitelist of clients that
# can query the jolokia /metrics/v2 endpoint
class puppet::server(
class puppet::server (
Variant[Boolean, Stdlib::Absolutepath] $autosign = $puppet::autosign,
Array[String] $autosign_entries = $puppet::autosign_entries,
Pattern[/^[0-9]{3,4}$/] $autosign_mode = $puppet::autosign_mode,
Expand All @@ -351,7 +351,7 @@
String $group = $puppet::server_group,
String $dir = $puppet::server_dir,
Stdlib::Absolutepath $codedir = $puppet::codedir,
Integer $port = $puppet::server_port,
Stdlib::Port $port = $puppet::server_port,
String $ip = $puppet::server_ip,
Boolean $ca = $puppet::server_ca,
Optional[String] $ca_crl_filepath = $puppet::ca_crl_filepath,
Expand All @@ -362,7 +362,7 @@
Array[String] $ca_client_whitelist = $puppet::server_ca_client_whitelist,
Optional[Puppet::Custom_trusted_oid_mapping] $custom_trusted_oid_mapping = $puppet::server_custom_trusted_oid_mapping,
Boolean $http = $puppet::server_http,
Integer $http_port = $puppet::server_http_port,
Stdlib::Port $http_port = $puppet::server_http_port,
String $reports = $puppet::server_reports,
Stdlib::Absolutepath $puppetserver_vardir = $puppet::server_puppetserver_vardir,
Optional[Stdlib::Absolutepath] $puppetserver_rundir = $puppet::server_puppetserver_rundir,
Expand Down Expand Up @@ -437,7 +437,7 @@
Boolean $metrics_jmx_enable = $puppet::server_metrics_jmx_enable,
Boolean $metrics_graphite_enable = $puppet::server_metrics_graphite_enable,
String $metrics_graphite_host = $puppet::server_metrics_graphite_host,
Integer $metrics_graphite_port = $puppet::server_metrics_graphite_port,
Stdlib::Port $metrics_graphite_port = $puppet::server_metrics_graphite_port,
String $metrics_server_id = $puppet::server_metrics_server_id,
Integer $metrics_graphite_interval = $puppet::server_metrics_graphite_interval,
Variant[Undef, Array] $metrics_allowed = $puppet::server_metrics_allowed,
Expand Down
Loading