Skip to content

Commit 0bf223a

Browse files
fflemingtruthbk
authored andcommitted
Allow specification of CA cert for HTTP status check (#418)
* add ca_certs configuration * test for ca_certs line * fix scoping bug previously, the ca_certs conditional was nested in the 'tls cert check is disabled' conditional. while it doesn't make a _ton_ of sense to provide a ca cert when you aren't checking it, allowing users to do so makes migrating from an unchecked to a checked workflow easier. I don't see a downside to allowing this behavior. * whitespace to trigger build * Revert "whitespace to trigger build" This reverts commit e875f27.
1 parent e7f07e5 commit 0bf223a

3 files changed

Lines changed: 11 additions & 1 deletion

File tree

manifests/integrations/http_check.pp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@
4949
# check to create a metric 'network.http.response_time', tagged with
5050
# the url, reporting the response time in seconds.
5151
#
52+
# ca_certs
53+
# An optional string representing the path to CA certificates.
54+
#
5255
# disable_ssl_validation
5356
# The setting disable_ssl_validation parameter to true will instruct
5457
# the http client to accept self signed, expired and otherwise
@@ -168,6 +171,7 @@
168171
$tags = [],
169172
$contact = [],
170173
$instances = undef,
174+
$ca_certs = undef,
171175
) inherits datadog_agent::params {
172176
include datadog_agent
173177

@@ -194,6 +198,7 @@
194198
'allow_redirects' => $allow_redirects,
195199
'tags' => $tags,
196200
'contact' => $contact,
201+
'ca_certs' => $ca_certs,
197202
}]
198203
} elsif !$instances{
199204
$_instances = []

spec/classes/datadog_agent_integrations_http_check_spec.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@
6969
check_certificate_expiration: true,
7070
days_warning: 14,
7171
days_critical: 7,
72-
allow_redirects: true
72+
allow_redirects: true,
73+
ca_certs: '/dev/null'
7374
}}
7475

7576
it { should contain_file(conf_file).with_content(%r{name: foo.bar.baz}) }
@@ -90,6 +91,7 @@
9091
it { should contain_file(conf_file).with_content(%r{days_warning: 14}) }
9192
it { should contain_file(conf_file).with_content(%r{days_critical: 7}) }
9293
it { should contain_file(conf_file).with_content(%r{allow_redirects: true}) }
94+
it { should contain_file(conf_file).with_content(%r{ca_certs: /dev/null}) }
9395
end
9496

9597
context 'with headers parameter array' do

templates/agent-conf.d/http_check.yaml.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ instances:
4242
<% unless instance['no_proxy'].nil? -%>
4343
no_proxy: <%= instance['no_proxy'] %>
4444
<% end -%>
45+
<% if instance['ca_certs'] -%>
46+
ca_certs: <%= instance['ca_certs'] %>
47+
<% end -%>
4548
<% unless instance['check_certificate_expiration'].nil? -%>
4649
check_certificate_expiration: <%= instance['check_certificate_expiration'] %>
4750
<% if instance['check_certificate_expiration'] == true -%>

0 commit comments

Comments
 (0)