Skip to content

Commit 688a5a3

Browse files
committed
Merge #305 into master
2 parents 6af3052 + e109e62 commit 688a5a3

5 files changed

Lines changed: 52 additions & 0 deletions

File tree

manifests/init.pp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
$node_ttl = $puppetdb::params::node_ttl,
3939
$node_purge_ttl = $puppetdb::params::node_purge_ttl,
4040
$report_ttl = $puppetdb::params::report_ttl,
41+
Optional[Array] $facts_blacklist = $puppetdb::params::facts_blacklist,
4142
$gc_interval = $puppetdb::params::gc_interval,
4243
$log_slow_statements = $puppetdb::params::log_slow_statements,
4344
$conn_max_age = $puppetdb::params::conn_max_age,
@@ -114,6 +115,7 @@
114115
node_ttl => $node_ttl,
115116
node_purge_ttl => $node_purge_ttl,
116117
report_ttl => $report_ttl,
118+
facts_blacklist => $facts_blacklist,
117119
gc_interval => $gc_interval,
118120
log_slow_statements => $log_slow_statements,
119121
conn_max_age => $conn_max_age,

manifests/params.pp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
$node_purge_ttl = '14d'
4343
$report_ttl = '14d'
4444

45+
$facts_blacklist = undef
46+
4547
$gc_interval = '60'
4648

4749
$log_slow_statements = '10'

manifests/server.pp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
$node_ttl = $puppetdb::params::node_ttl,
3333
$node_purge_ttl = $puppetdb::params::node_purge_ttl,
3434
$report_ttl = $puppetdb::params::report_ttl,
35+
Optional[Array] $facts_blacklist = $puppetdb::params::facts_blacklist,
3536
$gc_interval = $puppetdb::params::gc_interval,
3637
$log_slow_statements = $puppetdb::params::log_slow_statements,
3738
$conn_max_age = $puppetdb::params::conn_max_age,
@@ -171,6 +172,7 @@
171172
node_ttl => $node_ttl,
172173
node_purge_ttl => $node_purge_ttl,
173174
report_ttl => $report_ttl,
175+
facts_blacklist => $facts_blacklist,
174176
gc_interval => $gc_interval,
175177
log_slow_statements => $log_slow_statements,
176178
conn_max_age => $conn_max_age,

manifests/server/database.pp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
$node_ttl = $puppetdb::params::node_ttl,
1414
$node_purge_ttl = $puppetdb::params::node_purge_ttl,
1515
$report_ttl = $puppetdb::params::report_ttl,
16+
$facts_blacklist = $puppetdb::params::facts_blacklist,
1617
$gc_interval = $puppetdb::params::gc_interval,
1718
$log_slow_statements = $puppetdb::params::log_slow_statements,
1819
$conn_max_age = $puppetdb::params::conn_max_age,
@@ -171,4 +172,18 @@
171172
}
172173
}
173174
}
175+
176+
if ($facts_blacklist) and length($facts_blacklist) != 0 {
177+
$joined_facts_blacklist = join($facts_blacklist, ', ')
178+
ini_setting { 'puppetdb_facts_blacklist':
179+
setting => 'facts-blacklist',
180+
value => $joined_facts_blacklist,
181+
}
182+
} else {
183+
ini_setting { 'puppetdb_facts_blacklist':
184+
ensure => absent,
185+
setting => 'facts-blacklist',
186+
}
187+
}
188+
174189
}

spec/unit/classes/server/database_ini_spec.rb

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,37 @@
155155
)
156156
}
157157
it { is_expected.not_to contain_ini_setting('puppetdb_database_max_pool_size') }
158+
it {
159+
is_expected.to contain_ini_setting('puppetdb_facts_blacklist')
160+
.with(
161+
'ensure' => 'absent',
162+
'path' => '/etc/puppetlabs/puppetdb/conf.d/database.ini',
163+
'section' => 'database',
164+
'setting' => 'facts-blacklist',
165+
)
166+
}
167+
end
168+
169+
describe 'when using facts_blacklist' do
170+
let(:params) do
171+
{
172+
'facts_blacklist' => [
173+
'one_fact',
174+
'another_fact',
175+
],
176+
}
177+
end
178+
179+
it {
180+
is_expected.to contain_ini_setting('puppetdb_facts_blacklist')
181+
.with(
182+
'ensure' => 'present',
183+
'path' => '/etc/puppetlabs/puppetdb/conf.d/database.ini',
184+
'section' => 'database',
185+
'setting' => 'facts-blacklist',
186+
'value' => 'one_fact, another_fact',
187+
)
188+
}
158189
end
159190

160191
describe 'when using a legacy PuppetDB version' do

0 commit comments

Comments
 (0)