Skip to content

Commit 5684083

Browse files
fix: do not set empty tls_protocols_allowed and tls_ciphers for es (#852)
* fix: do not set empty tls_protocol_allowed and tls_ciphers for es * fix: do not fail when tls_protocols_allowed and tls_ciphers are not passed via _instances Fix: Added fallback for possible empty params * fix: remove whitespace
1 parent d2da2f8 commit 5684083

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

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

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,25 @@ instances:
3333
<%- if instance['tls_ignore_warning'] && instance['tls_ignore_warning'] != :undef -%>
3434
tls_ignore_warning: <%= instance['tls_ignore_warning'] %>
3535
<%- end -%>
36-
<%- unless instance['tags'].empty? -%>
36+
<%- tags = Array(instance['tags']) -%>
37+
<%- unless tags.empty? -%>
3738
tags:
38-
<%- instance['tags'].each do |tag| -%>
39+
<%- tags.each do |tag| -%>
3940
- <%= tag %>
40-
<%- end -%>
41+
<%- end -%>
4142
<%- end -%>
42-
<%- unless instance['tls_protocols_allowed'].nil? -%>
43+
<%- protocols = Array(instance['tls_protocols_allowed']) -%>
44+
<%- unless protocols.empty? -%>
4345
tls_protocols_allowed:
44-
<%- instance['tls_protocols_allowed'].each do |protocol| -%>
46+
<%- protocols.each do |protocol| -%>
4547
- <%= protocol %>
48+
<%- end -%>
4649
<%- end -%>
47-
<%- end -%>
48-
<%- unless instance['tls_ciphers'].nil? -%>
50+
<%- ciphers = Array(instance['tls_ciphers']) -%>
51+
<%- unless ciphers.empty? -%>
4952
tls_ciphers:
50-
<%- instance['tls_ciphers'].each do |cipher| -%>
53+
<%- ciphers.each do |cipher| -%>
5154
- <%= cipher %>
55+
<%- end -%>
5256
<%- end -%>
5357
<%- end -%>
54-
<%- end -%>

0 commit comments

Comments
 (0)