Skip to content

Commit

Permalink
Use $facts and fact() where applicable
Browse files Browse the repository at this point in the history
  • Loading branch information
ekohl committed Jan 10, 2023
1 parent 540d603 commit 4559b84
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 18 deletions.
2 changes: 1 addition & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
}
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 {
'use_srv_records': value => true;
Expand Down
21 changes: 7 additions & 14 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -33,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']

# 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 @@ -198,13 +194,10 @@

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

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

# Hashes containing additional settings
$additional_settings = {}
Expand All @@ -219,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 @@ -261,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
6 changes: 3 additions & 3 deletions manifests/server/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -173,19 +173,19 @@
command => "${puppet::puppetserver_cmd} ca migrate",
creates => $puppet::server::cadir,
onlyif => "test -d '${puppet::server::ssl_dir}/ca' && ! test -L '${puppet::server::ssl_dir}'",
path => $::path,
path => $facts['path'],
before => Exec['puppet_server_config-generate_ca_cert'],
}
}
} elsif $puppet::server::ca_crl_sync {
# If not a ca AND sync the crl from the ca master
if defined('$::servername') {
if $server_facts['servername'] {
file { $puppet::server::ssl_ca_crl:
ensure => file,
owner => $puppet::server::user,
group => $puppet::server::group,
mode => '0644',
content => file($::settings::cacrl, $::settings::hostcrl, '/dev/null'),
content => file($settings::cacrl, $settings::hostcrl, '/dev/null'),
}
}
}
Expand Down

0 comments on commit 4559b84

Please sign in to comment.