-
Notifications
You must be signed in to change notification settings - Fork 59
refactor out uchiwa::params to init.pp, add new users array option #47
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,23 +96,34 @@ | |
# An array of API endpoints to connect uchiwa to one or multiple sensu servers. | ||
# | ||
class uchiwa ( | ||
$package_name = $uchiwa::params::package_name, | ||
$service_name = $uchiwa::params::service_name, | ||
$version = $uchiwa::params::version, | ||
$install_repo = $uchiwa::params::install_repo, | ||
$repo = $uchiwa::params::repo, | ||
$repo_source = $uchiwa::params::repo_source, | ||
$repo_key_id = $uchiwa::params::repo_key_id, | ||
$repo_key_source = $uchiwa::params::repo_key_source, | ||
$manage_services = $uchiwa::params::manage_services, | ||
$manage_user = $uchiwa::params::manage_user, | ||
$host = $uchiwa::params::host, | ||
$port = $uchiwa::params::port, | ||
$user = $uchiwa::params::user, | ||
$pass = $uchiwa::params::pass, | ||
$refresh = $uchiwa::params::refresh, | ||
$sensu_api_endpoints = $uchiwa::params::sensu_api_endpoints, | ||
) inherits uchiwa::params { | ||
$package_name = 'uchiwa', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree that we were not really using params at all. |
||
$service_name = 'uchiwa', | ||
$version = 'latest', | ||
$install_repo = true, | ||
$repo = 'main', | ||
$repo_source = undef, | ||
$repo_key_id = '7580C77F', | ||
$repo_key_source = 'http://repos.sensuapp.org/apt/pubkey.gpg', | ||
$manage_services = true, | ||
$manage_user = true, | ||
$host = '0.0.0.0', | ||
$port = '3000', | ||
$user = '', | ||
$pass = '', | ||
$users = [], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs a docstring on the format There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what do mean by docstring -- as in puppet docs? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yea... but looking at this now I don't know what it is in reference to. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i'm not sure i understand what you mean - but it is in line with the On Thu, Jul 9, 2015 at 11:19 PM, Kyle Anderson [email protected]
|
||
$refresh = '5', | ||
$sensu_api_endpoints = [{ | ||
name => 'sensu', | ||
host => '127.0.0.1', | ||
ssl => false, | ||
insecure => false, | ||
port => 4567, | ||
user => 'sensu', | ||
pass => 'sensu', | ||
path => '', | ||
timeout => 5, | ||
}] | ||
) { | ||
|
||
# validate parameters here | ||
validate_bool($install_repo) | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"sensu": [ | ||
<%- default_endpoint = scope['uchiwa::sensu_api_endpoints'][0] -%> | ||
<%- @sensu_api_endpoints.each_with_index do |endpoint, i| -%> | ||
{ | ||
"name": "<%= endpoint['name'] || default_endpoint['name'] %>", | ||
"host": "<%= endpoint['host'] || default_endpoint['host'] %>", | ||
"ssl": <%= endpoint['ssl'] || default_endpoint['ssl'] %>, | ||
"insecure": <%= endpoint['insecure'] || default_endpoint['insecure']%>, | ||
"port": <%= endpoint['port'] || default_endpoint['port'] %>, | ||
"user": "<%= endpoint['user'] || default_endpoint['user'] %>", | ||
"pass": "<%= endpoint['pass'] || default_endpoint['pass'] %>", | ||
"path": "<%= endpoint['path'] || default_endpoint['path'] %>", | ||
"timeout": <%= endpoint['timeout'] || default_endpoint['timeout'] %> | ||
}<%= ',' if i < (@sensu_api_endpoints.size - 1) %> | ||
<%- end -%> | ||
], | ||
"uchiwa": { | ||
"host": "<%= @host %>", | ||
"port": <%= @port %>, | ||
"users": [ | ||
<%- @users.each_with_index do |user, i| -%> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs some sort of unit test to prove that it works |
||
{ | ||
"username": "<%= user['username'] %>", | ||
"password": "<%= user['password'] %>", | ||
"role": { | ||
"readonly": <%= user['readonly'] %> | ||
} | ||
}<%= ',' if i < (@users.size - 1) %> | ||
<%- end -%> | ||
] | ||
"refresh": <%= @refresh %> | ||
} | ||
} | ||
|
||
$uchiwa::users |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not have two entrypoints for when users or set or not.
Reduce duplication here, just have one template