Skip to content

Commit

Permalink
[http_check] fixing variable reassignment, and template.
Browse files Browse the repository at this point in the history
[http_check] fixing template.

[http_check] fixing yaml alignment.
  • Loading branch information
truthbk committed Apr 12, 2016
1 parent e05b0b1 commit 43fe1b4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
4 changes: 3 additions & 1 deletion manifests/integrations/http_check.pp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
) inherits datadog_agent::params {

if $instances == undef {
$instances = [{
$_instances = [{
'url' => $url,
'username' => $username,
'password' => $password,
Expand All @@ -104,6 +104,8 @@
'tags' => $tags,
'contact' => $contact,
}]
} else {
$_instances = $instances
}

file { "${datadog_agent::params::conf_dir}/http_check.yaml":
Expand Down
34 changes: 17 additions & 17 deletions templates/agent-conf.d/http_check.yaml.erb
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
init_config:

instances:
<%- (Array(@instances)).each do |instance| -%>
- name: <%= instance['name'] %>
url: <%= instance['url'] %>
<%- (Array(@_instances)).each do |instance| -%>
- name: <%= instance['name'] %>
url: <%= instance['url'] %>
<% if instance['timeout'] -%>
timeout: <%= instance['timeout'] %>
timeout: <%= instance['timeout'] %>
<% end -%>
<% if instance['username'] -%>
username: <%= instance['username'] %>
username: <%= instance['username'] %>
<% end -%>
<% if instance['password'] -%>
password: <%= instance['password'] %>
password: <%= instance['password'] %>
<% end -%>
<% if instance['threshold'] -%>
threshold: <%= instance['threshold'] %>
threshold: <%= instance['threshold'] %>
<% end -%>
<% if instance['window'] -%>
window: <%= instance['window'] %>
window: <%= instance['window'] %>
<% end -%>
<% if instance['include_content'] -%>
include_content: <%= instance['include_content'] %>
include_content: <%= instance['include_content'] %>
<% end -%>
<% if instance['collect_response_time'] -%>
collect_response_time: <%= instance['collect_response_time'] %>
collect_response_time: <%= instance['collect_response_time'] %>
<% end -%>
disable_ssl_validation: <%= instance['disable_ssl_validation'] %>
disable_ssl_validation: <%= instance['disable_ssl_validation'] %>
<% if instance['headers'] and ! instance['headers'].empty? -%>
headers:
headers:
<%- Array(instance['headers']).each do |header| -%>
<%- if header != '' -%>
<%= header %>
<%= header %>
<%- end -%>
<%- end -%>
<% end -%>
<% if instance['tags'] and ! instance['tags'].empty? -%>
tags:
tags:
<%- Array(instance['tags']).each do |tag| -%>
<%- if tag != '' -%>
- <%= tag %>
- <%= tag %>
<%- end -%>
<%- end -%>
<% end -%>
<% if instance['contacts'] and ! instance['contacts'].empty? -%>
notify:
notify:
<%- Array(instance['contacts']).each do |contact| -%>
<%- if contact != '' -%>
- <%= contact %>
- <%= contact %>
<%- end -%>
<%- end -%>
<% end -%>
Expand Down

0 comments on commit 43fe1b4

Please sign in to comment.