Skip to content

Commit d4f7a61

Browse files
authored
[proxy] dont be chatty (DataDog#484)
1 parent c0c2be8 commit d4f7a61

2 files changed

Lines changed: 10 additions & 15 deletions

File tree

manifests/init.pp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,10 @@
245245
$statsd_forward_host = '',
246246
$statsd_forward_port = '',
247247
$statsd_histogram_percentiles = '0.95',
248-
$proxy_host = '',
249-
$proxy_port = '',
250-
$proxy_user = '',
251-
$proxy_password = '',
248+
Optional[String] $proxy_host = undef,
249+
Optional[Variant[Integer, Pattern[/^\d*$/]]] $proxy_port = undef,
250+
Optional[String] $proxy_user = undef,
251+
Optional[String] $proxy_password = undef,
252252
$graphite_listen_port = '',
253253
$extra_template = '',
254254
$ganglia_host = '',
@@ -317,7 +317,6 @@
317317
# lint:ignore:only_variable_string
318318
$_dogstatsd_port = "${dogstatsd_port}"
319319
$_statsd_forward_port = "${statsd_forward_port}"
320-
$_proxy_port = "${proxy_port}"
321320
$_graphite_listen_port = "${graphite_listen_port}"
322321
$_listen_port = "${listen_port}"
323322
$_pup_port = "${pup_port}"
@@ -342,10 +341,6 @@
342341
validate_legacy(String, 'validate_re', $_dogstatsd_port, '^\d*$')
343342
validate_legacy(String, 'validate_string', $statsd_histogram_percentiles)
344343
validate_legacy(String, 'validate_re', $_statsd_forward_port, '^\d*$')
345-
validate_legacy(String, 'validate_string', $proxy_host)
346-
validate_legacy(String, 'validate_re', $_proxy_port, '^\d*$')
347-
validate_legacy(String, 'validate_string', $proxy_user)
348-
validate_legacy(String, 'validate_string', $proxy_password)
349344
validate_legacy(String, 'validate_re', $_graphite_listen_port, '^\d*$')
350345
validate_legacy(String, 'validate_string', $extra_template)
351346
validate_legacy(String, 'validate_string', $ganglia_host)
@@ -578,7 +573,7 @@
578573
if !empty($proxy_host) {
579574
notify { 'Setting proxy_host will have no effect on agent6 please use agent6_extra_options to set your proxy': }
580575
}
581-
if !empty($_proxy_port) {
576+
if !empty($proxy_port) {
582577
notify { 'Setting proxy_port will have no effect on agent6 please use agent6_extra_options to set your proxy': }
583578
}
584579
if !empty($proxy_user) {

templates/datadog_header.conf.erb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,22 @@
66
dd_url: <%= @_dd_url %>
77

88
# If you need a proxy to connect to the Internet, provide the settings here
9-
<% if @proxy_host.empty? -%>
9+
<% if !defined?(@proxy_host) || @proxy_host.empty? -%>
1010
# proxy_host:
1111
<% else -%>
1212
proxy_host: <%= @proxy_host %>
1313
<% end -%>
14-
<% if @_proxy_port.empty? -%>
14+
<% if !defined?(@proxy_port) || "#{@proxy_port}".empty? -%>
1515
# proxy_port:
1616
<% else -%>
17-
proxy_port: <%= @_proxy_port %>
17+
proxy_port: <%= @proxy_port %>
1818
<% end -%>
19-
<% if @proxy_user.empty? -%>
19+
<% if !defined?(@proxy_user) || @proxy_user.empty? -%>
2020
# proxy_user:
2121
<% else -%>
2222
proxy_user: <%= @proxy_user %>
2323
<% end -%>
24-
<% if @proxy_password.empty? -%>
24+
<% if !defined?(@proxy_password) || @proxy_password.empty? -%>
2525
# proxy_password:
2626
<% else -%>
2727
proxy_password: <%= @proxy_password %>

0 commit comments

Comments
 (0)