Skip to content
This repository has been archived by the owner on Feb 4, 2020. It is now read-only.

Fix template so it generates valid JSON #2

Merged
merged 1 commit into from
Aug 7, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions templates/etc/sensu/uchiwa.json.erb
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
module.exports = {
sensu: [
<%- scope.lookupvar("uchiwa::apis").each do | name, api | %>
{
"sensu": [
<% scope.lookupvar('uchiwa::apis').each_with_index do |(name,api),index| -%>
{
name: '<%= name %>',
host: '<%= api['host'] %>',
ssl: <%= api['ssl'] %>,
port: <%= api['port'] %>,
user: '<%= api['user'] %>',
pass: '<%= api['pass'] %>',
path: '<%= api['path'] %>',
timeout: <%= api['timeout'] %>
},
<%- end %>
"name": "<%= name %>",
"host": "<%= api['host'] %>",
"port": <%= api['port'] || 4567 %>,
"ssl": <%= api['ssl'] || false %>,
"user": "<%= api['user'] %>",
"pass": "<%= api['pass'] %>",
"path": "<%= api['path'] %>",
"timeout": <%= api['timeout'] || 5000 %>
}<%= ',' if index < scope.lookupvar('uchiwa::apis').length - 1 %>
<% end -%>
],
uchiwa: {
host: '<%= scope.lookupvar("uchiwa::host") %>',
port: <%= scope.lookupvar('uchiwa::port') %>,
user: '<%= scope.lookupvar("uchiwa::user") %>',
pass: '<%= scope.lookupvar("uchiwa::pass") %>',
stats: <%= scope.lookupvar('uchiwa::stats') %>,
refresh: <%= scope.lookupvar('uchiwa::refresh') %>
"uchiwa": {
"host": "<%= scope.lookupvar('uchiwa::host') %>",
"port": <%= scope.lookupvar('uchiwa::port') %>,
"user": "<%= scope.lookupvar('uchiwa::user') %>",
"pass": "<%= scope.lookupvar('uchiwa::pass') %>",
"stats": <%= scope.lookupvar('uchiwa::stats') %>,
"refresh": <%= scope.lookupvar('uchiwa::refresh') %>
}
}
}