Skip to content

Commit 5fbb0bc

Browse files
fix: do not fail when tls_protocols_allowed and tls_ciphers are not passed via _instances
Fix: Added fallback for possible empty params
1 parent 4780f9f commit 5fbb0bc

2 files changed

Lines changed: 16 additions & 13 deletions

File tree

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

Lines changed: 16 additions & 13 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 -%>
42-
<%- unless instance['tls_protocols_allowed'].empty? -%>
41+
<% end %>
42+
<% end %>
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 %>
46-
<%- end -%>
47-
<%- end -%>
48-
<%- unless instance['tls_ciphers'].empty? -%>
48+
<% end %>
49+
<% end %>
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 %>
52-
<%- end -%>
53-
<%- end -%>
54-
<%- end -%>
55+
<% end %>
56+
<% end %>
57+
<% end %>

templates/agent-conf.d/test.yaml

Whitespace-only changes.

0 commit comments

Comments
 (0)