Skip to content

(maint) Fix dynamic-scope resource defaults #356

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
6 changes: 5 additions & 1 deletion manifests/master/puppetdb_conf.pp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
) inherits puppetdb::params {

Ini_setting {
$ini_setting_defaults = {
ensure => present,
section => 'main',
path => "${puppet_confdir}/puppetdb.conf",
Expand All @@ -24,20 +24,24 @@
ini_setting { 'puppetdbserver':
setting => 'server',
value => $server,
* => $ini_setting_defaults,
}
ini_setting { 'puppetdbport':
setting => 'port',
value => $port,
* => $ini_setting_defaults,
}
} else {
ini_setting { 'puppetdbserver_urls':
setting => 'server_urls',
value => "https://${server}:${port}/",
* => $ini_setting_defaults,
}
}

ini_setting { 'soft_write_failure':
setting => 'soft_write_failure',
value => $soft_write_failure,
* => $ini_setting_defaults,
}
}
4 changes: 3 additions & 1 deletion manifests/master/storeconfigs.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
default => absent,
}

Ini_setting {
$ini_setting_defaults = {
section => $puppet_conf_section,
path => $puppet_conf,
ensure => $storeconfigs_ensure,
Expand All @@ -26,10 +26,12 @@
ini_setting { "puppet.conf/${puppet_conf_section}/storeconfigs":
setting => 'storeconfigs',
value => true,
* => $ini_setting_defaults,
}

ini_setting { "puppet.conf/${puppet_conf_section}/storeconfigs_backend":
setting => 'storeconfigs_backend',
value => 'puppetdb',
* => $ini_setting_defaults,
}
}
15 changes: 13 additions & 2 deletions manifests/server/command_processing.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,58 +10,69 @@
$config_ini = "${confdir}/config.ini"

# Set the defaults
Ini_setting {
$ini_setting_defaults = {
path => $config_ini,
ensure => 'present',
section => 'command-processing',
require => File[$config_ini],
}

if $command_threads {
ini_setting { 'puppetdb_command_processing_threads':
ensure => 'present',
setting => 'threads',
value => $command_threads,
* => $ini_setting_defaults,
}
} else {
ini_setting { 'puppetdb_command_processing_threads':
ensure => 'absent',
setting => 'threads',
* => $ini_setting_defaults,
}
}

if $concurrent_writes {
ini_setting { 'puppetdb_command_processing_concurrent_writes':
ensure => 'present',
setting => 'concurrent-writes',
value => $concurrent_writes,
* => $ini_setting_defaults,
}
} else {
ini_setting { 'puppetdb_command_processing_concurrent_writes':
ensure => 'absent',
setting => 'concurrent-writes',
* => $ini_setting_defaults,
}
}

if $store_usage {
ini_setting { 'puppetdb_command_processing_store_usage':
ensure => 'present',
setting => 'store-usage',
value => $store_usage,
* => $ini_setting_defaults,
}
} else {
ini_setting { 'puppetdb_command_processing_store_usage':
ensure => 'absent',
setting => 'store-usage',
* => $ini_setting_defaults,
}
}

if $temp_usage {
ini_setting { 'puppetdb_command_processing_temp_usage':
ensure => 'present',
setting => 'temp-usage',
value => $temp_usage,
* => $ini_setting_defaults,
}
} else {
ini_setting { 'puppetdb_command_processing_temp_usage':
ensure => 'absent',
setting => 'temp-usage',
* => $ini_setting_defaults,
}
}
}
141 changes: 72 additions & 69 deletions manifests/server/database.pp
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,8 @@
default => [$file_require, Class['puppetdb::server::validate_db']],
}
# Set the defaults
Ini_setting {
$ini_setting_defaults = {
path => $database_ini,
ensure => present,
section => 'database',
require => $ini_setting_require
}
Expand Down Expand Up @@ -109,112 +108,116 @@

##Only setup for postgres
ini_setting { 'puppetdb_psdatabase_username':
ensure => present,
setting => 'username',
value => $database_username,
* => $ini_setting_defaults,
}

if $database_password != undef and $manage_db_password {
ini_setting { 'puppetdb_psdatabase_password':
ensure => present,
setting => 'password',
value => $database_password,
* => $ini_setting_defaults,
}
}
}

ini_setting { 'puppetdb_classname':
setting => 'classname',
value => $classname,
ini_setting{
default:
ensure => present,
* => $ini_setting_defaults,
;
'puppetdb_classname':
setting => 'classname',
value => $classname,
;
'puppetdb_subprotocol':
setting => 'subprotocol',
value => $subprotocol,
;
'puppetdb_pgs':
setting => 'syntax_pgs',
value => true,
;
'puppetdb_subname':
setting => 'subname',
value => $subname,
;
'puppetdb_gc_interval':
setting => 'gc-interval',
value => $gc_interval,
;
'puppetdb_node_purge_gc_batch_limit':
setting => 'node-purge-gc-batch-limit',
value => $node_purge_gc_batch_limit,
;
'puppetdb_node_ttl':
setting => 'node-ttl',
value => $node_ttl,
;
'puppetdb_node_purge_ttl':
setting => 'node-purge-ttl',
value => $node_purge_ttl,
;
'puppetdb_report_ttl':
setting => 'report-ttl',
value => $report_ttl,
;
'puppetdb_log_slow_statements':
setting => 'log-slow-statements',
value => $log_slow_statements,
;
'puppetdb_conn_max_age':
setting => 'conn-max-age',
value => $conn_max_age,
;
'puppetdb_conn_keep_alive':
setting => 'conn-keep-alive',
value => $conn_keep_alive,
;
'puppetdb_conn_lifetime':
setting => 'conn-lifetime',
value => $conn_lifetime,
;
'puppetdb_migrate':
setting => 'migrate',
value => $migrate,
;
}

ini_setting { 'puppetdb_subprotocol':
setting => 'subprotocol',
value => $subprotocol,
}

ini_setting { 'puppetdb_pgs':
setting => 'syntax_pgs',
value => true,
}

ini_setting { 'puppetdb_subname':
setting => 'subname',
value => $subname,
}

ini_setting { 'puppetdb_gc_interval':
setting => 'gc-interval',
value => $gc_interval,
}

ini_setting { 'puppetdb_node_purge_gc_batch_limit':
setting => 'node-purge-gc-batch-limit',
value => $node_purge_gc_batch_limit,
}

ini_setting { 'puppetdb_node_ttl':
setting => 'node-ttl',
value => $node_ttl,
}

ini_setting { 'puppetdb_node_purge_ttl':
setting => 'node-purge-ttl',
value => $node_purge_ttl,
}

ini_setting { 'puppetdb_report_ttl':
setting => 'report-ttl',
value => $report_ttl,
}

ini_setting { 'puppetdb_log_slow_statements':
setting => 'log-slow-statements',
value => $log_slow_statements,
}

ini_setting { 'puppetdb_conn_max_age':
setting => 'conn-max-age',
value => $conn_max_age,
}

ini_setting { 'puppetdb_conn_keep_alive':
setting => 'conn-keep-alive',
value => $conn_keep_alive,
}

ini_setting { 'puppetdb_conn_lifetime':
setting => 'conn-lifetime',
value => $conn_lifetime,
}

ini_setting { 'puppetdb_migrate':
setting => 'migrate',
value => $migrate,
}

if $puppetdb::params::database_max_pool_size_setting_name != undef {
if $database_max_pool_size == 'absent' {
ini_setting { 'puppetdb_database_max_pool_size':
ensure => absent,
setting => $puppetdb::params::database_max_pool_size_setting_name,
* => $ini_setting_defaults,
}
} elsif $database_max_pool_size != undef {
ini_setting { 'puppetdb_database_max_pool_size':
ensure => present,
setting => $puppetdb::params::database_max_pool_size_setting_name,
value => $database_max_pool_size,
* => $ini_setting_defaults,
}
}
}

if ($facts_blacklist) and length($facts_blacklist) != 0 {
$joined_facts_blacklist = join($facts_blacklist, ', ')
ini_setting { 'puppetdb_facts_blacklist':
ensure => present,
setting => 'facts-blacklist',
value => $joined_facts_blacklist,
* => $ini_setting_defaults,
}
} else {
ini_setting { 'puppetdb_facts_blacklist':
ensure => absent,
setting => 'facts-blacklist',
* => $ini_setting_defaults,
}
}
}
5 changes: 3 additions & 2 deletions manifests/server/global.pp
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,18 @@
}

# Set the defaults
Ini_setting {
$ini_setting_defaults = {
path => $config_ini,
ensure => 'present',
section => 'global',
require => File[$config_ini],
}

if $vardir {
ini_setting { 'puppetdb_global_vardir':
ensure => present,
setting => 'vardir',
value => $vardir,
* => $ini_setting_defaults,
}
}
}
Loading
Loading