Skip to content

Commit 9a3863e

Browse files
Merge branch 'txaj-add-stringify_facts-opt'
2 parents a4390d9 + 97778a6 commit 9a3863e

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

manifests/agent.pp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
# ['digest_algorithm'] - The algorithm to use for file digests.
2626
# ['templatedir'] - Template dir, if unset it will remove the setting.
2727
# ['configtimeout'] - How long the client should wait for the configuration to be retrieved before considering it a failure
28+
# ['stringify_facts'] - Wether puppet transforms structured facts in strings or no. Defaults to true in puppet < 4, deprecated in puppet >=4 (and will default to false)
2829
#
2930
# Actions:
3031
# - Install and configures the puppet agent
@@ -62,6 +63,7 @@
6263
$reportserver = '$server',
6364
$digest_algorithm = $::puppet::params::digest_algorithm,
6465
$configtimeout = '2m',
66+
$stringify_facts = undef,
6567
) inherits puppet::params {
6668

6769
if ! defined(User[$::puppet::params::puppet_user]) {
@@ -310,4 +312,11 @@
310312
setting => 'configtimeout',
311313
value => $configtimeout,
312314
}
315+
if $stringify_facts != undef {
316+
ini_setting {'puppetagentstringifyfacts':
317+
ensure => present,
318+
setting => 'stringify_facts',
319+
value => $stringify_facts,
320+
}
321+
}
313322
}

spec/classes/puppet_agent_spec.rb

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,4 +549,30 @@
549549
}
550550
end
551551
end
552+
describe 'puppetagentstringifyfacts' do
553+
let(:facts) do
554+
{
555+
:osfamily => 'RedHat',
556+
:operatingsystem => 'RedHat',
557+
:kernel => 'Linux'
558+
}
559+
end
560+
context 'with stringify_facts set' do
561+
let(:params) do
562+
{
563+
:stringify_facts => true,
564+
}
565+
end
566+
567+
it{
568+
should contain_ini_setting('puppetagentstringifyfacts').with(
569+
:ensure => 'present',
570+
:section => 'agent',
571+
:setting => 'stringify_facts',
572+
:value => 'true',
573+
:path => '/etc/puppet/puppet.conf'
574+
)
575+
}
576+
end
577+
end
552578
end

0 commit comments

Comments
 (0)