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

add option to set facts_blacklist_type. only actually adds the settin… #318

Open
wants to merge 1 commit 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
2 changes: 2 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
$node_ttl = $puppetdb::params::node_ttl,
$node_purge_ttl = $puppetdb::params::node_purge_ttl,
$report_ttl = $puppetdb::params::report_ttl,
$facts_blacklist_type = $puppetdb::params::facts_blacklist_type,
Optional[Array] $facts_blacklist = $puppetdb::params::facts_blacklist,
$gc_interval = $puppetdb::params::gc_interval,
$node_purge_gc_batch_limit = $puppetdb::params::node_purge_gc_batch_limit,
Expand Down Expand Up @@ -119,6 +120,7 @@
node_ttl => $node_ttl,
node_purge_ttl => $node_purge_ttl,
report_ttl => $report_ttl,
facts_blacklist_type => $facts_blacklist_type,
facts_blacklist => $facts_blacklist,
gc_interval => $gc_interval,
node_purge_gc_batch_limit => $node_purge_gc_batch_limit,
Expand Down
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
$node_purge_ttl = '14d'
$report_ttl = '14d'

$facts_blacklist_type = undef
$facts_blacklist = undef

$gc_interval = '60'
Expand Down
6 changes: 6 additions & 0 deletions manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
$node_ttl = $puppetdb::params::node_ttl,
$node_purge_ttl = $puppetdb::params::node_purge_ttl,
$report_ttl = $puppetdb::params::report_ttl,
$facts_blacklist_type = $puppetdb::params::facts_blacklist_type,
Optional[Array] $facts_blacklist = $puppetdb::params::facts_blacklist,
$gc_interval = $puppetdb::params::gc_interval,
$node_purge_gc_batch_limit = $puppetdb::params::node_purge_gc_batch_limit,
Expand Down Expand Up @@ -129,6 +130,10 @@
fail("read_database must be 'postgres'. You provided '${read_database}'")
}

if !($facts_blacklist_type in [undef, 'literal', 'regex']) {
fail("facts_blacklist_type must be literal (default if not supplied) or regex. You provided '${facts_blacklist_type}'")
}

package { $puppetdb_package:
ensure => $puppetdb::params::puppetdb_version,
notify => Service[$puppetdb_service],
Expand Down Expand Up @@ -175,6 +180,7 @@
node_ttl => $node_ttl,
node_purge_ttl => $node_purge_ttl,
report_ttl => $report_ttl,
facts_blacklist_type => $facts_blacklist_type,
facts_blacklist => $facts_blacklist,
gc_interval => $gc_interval,
node_purge_gc_batch_limit => $node_purge_gc_batch_limit,
Expand Down
13 changes: 13 additions & 0 deletions manifests/server/database.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
$node_ttl = $puppetdb::params::node_ttl,
$node_purge_ttl = $puppetdb::params::node_purge_ttl,
$report_ttl = $puppetdb::params::report_ttl,
$facts_blacklist_type = $puppetdb::params::facts_blacklist_type,
$facts_blacklist = $puppetdb::params::facts_blacklist,
$gc_interval = $puppetdb::params::gc_interval,
$node_purge_gc_batch_limit = $puppetdb::params::node_purge_gc_batch_limit,
Expand Down Expand Up @@ -185,6 +186,18 @@
}
}

if !($facts_blacklist_type in [undef, 'literal']) {
ini_setting { 'puppetdb_facts_blacklist_type':
setting => 'facts-blacklist-type',
value => $facts_blacklist_type,
}
} else {
ini_setting { 'puppetdb_facts_blacklist_type':
ensure => absent,
setting => 'facts-blacklist-type',
}
}

if ($facts_blacklist) and length($facts_blacklist) != 0 {
$joined_facts_blacklist = join($facts_blacklist, ', ')
ini_setting { 'puppetdb_facts_blacklist':
Expand Down