Skip to content

Commit 15c67f7

Browse files
flyinprogrammertruthbk
authored andcommitted
add extra_template back (#331)
1 parent 23a0720 commit 15c67f7

File tree

5 files changed

+36
-4
lines changed

5 files changed

+36
-4
lines changed

.fixtures.yml

+1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ fixtures:
99
ruby: "git://github.com/puppetlabs/puppetlabs-ruby.git"
1010
remote_file: "git://github.com/lwf/puppet-remote_file.git"
1111
symlinks:
12+
custom_datadog: "#{source_dir}/spec/custom_fixtures/custom_datadog"
1213
datadog_agent: "#{source_dir}"

Gemfile

+5-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ group :test do
1414
end
1515

1616
group :development do
17-
gem "beaker", '2.51.0'
1817
gem "beaker-rspec"
19-
gem "puppet-blacksmith"
20-
gem "nokogiri", "~> 1.6.0"
18+
gem "beaker", '2.51.0'
2119
gem "guard-rake"
20+
gem "hiera-eyaml"
21+
gem "nokogiri", "~> 1.6.0"
22+
gem "puppet-blacksmith"
23+
gem "xmlrpc" if RUBY_VERSION >= '2.3'
2224
end

manifests/init.pp

+12-1
Original file line numberDiff line numberDiff line change
@@ -405,10 +405,21 @@
405405
order => '05',
406406
}
407407

408+
if ($extra_template != '') {
409+
concat::fragment{ 'datadog extra_template footer':
410+
target => '/etc/dd-agent/datadog.conf',
411+
content => template($extra_template),
412+
order => '06',
413+
}
414+
$apm_footer_order = '07'
415+
} else {
416+
$apm_footer_order = '06'
417+
}
418+
408419
concat::fragment{ 'datadog apm footer':
409420
target => '/etc/dd-agent/datadog.conf',
410421
content => template('datadog_agent/datadog_apm_footer.conf.erb'),
411-
order => '06',
422+
order => $apm_footer_order,
412423
}
413424

414425

spec/classes/datadog_agent_spec.rb

+17
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,9 @@
568568
it { should contain_concat__fragment('datadog apm footer').with(
569569
'content' => /^env: foo\n/,
570570
)}
571+
it { should contain_concat__fragment('datadog apm footer').with(
572+
'order' => '06',
573+
)}
571574
end
572575
context 'with service_discovery enabled' do
573576
let(:params) {
@@ -593,6 +596,20 @@
593596
'content' => /^sd_jmx_enable: true\n/,
594597
)}
595598
end
599+
context 'with extra_template enabled' do
600+
let(:params) {
601+
{:extra_template => 'custom_datadog/extra_template_test.erb',
602+
}}
603+
it { should contain_concat__fragment('datadog extra_template footer').with(
604+
'order' => '06',
605+
)}
606+
it { should contain_concat__fragment('datadog extra_template footer').with(
607+
'content' => /^# extra template is here\n/,
608+
)}
609+
it { should contain_concat__fragment('datadog apm footer').with(
610+
'order' => '07',
611+
)}
612+
end
596613
end
597614
end
598615

Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# extra template is here

0 commit comments

Comments
 (0)