Remove some default lma_collector::params

This patch removes default parameters for InfluxDB/Elasticsearch HTTP port
and address. These parameters are always provided by callers and that the way
to go.

Change-Id: I5e346b71a7d639475f2fba92126f8d191f8cd5fd
This commit is contained in:
Swann Croiset 2016-05-31 09:39:28 +02:00
parent 87dd7fc51d
commit b2bb3f3ea9
7 changed files with 16 additions and 14 deletions

View File

@ -341,6 +341,7 @@ if hiera('lma::collector::influxdb::server', false) {
class { 'lma_collector::influxdb':
server => hiera('lma::collector::influxdb::server'),
port => hiera('lma::collector::influxdb::port'),
database => hiera('lma::collector::influxdb::database'),
user => hiera('lma::collector::influxdb::user'),
password => hiera('lma::collector::influxdb::password'),

View File

@ -487,7 +487,7 @@ Elasticsearch for indexing.
##### Parameters
* `server`: *Required*. Elasticsearch server name. Valid options: a string.
* `port`: *Optional*. Elasticsearch service port. Valid options: a string. Default: "9200".
* `port`: *Required*. Elasticsearch service port. Valid options: an integer.
#### Class: `lma_collector::logs::keystone_wsgi`
@ -801,8 +801,7 @@ InfluxDB.
* `user`: *Required*. InfluxDB username. Valid options: a string.
* `password`: *Required*. InfluxDB password. Valid options: a string.
* `server`: *Required*. InfluxDB server name. Valid options: a string.
* `port`: *Optional*. InfluxDB service port. Valid options: a string. Default:
`8086`.
* `port`: *Required*. InfluxDB service port. Valid options: an integer.
* `tag_fields`: *Optional*. List of message fields to be stored as tags. Valid
options: an array. Default: `[]`.
* `time_precision`: *Optional*. Time precision. Valid options: a string.

View File

@ -13,12 +13,13 @@
# under the License.
#
class lma_collector::elasticsearch (
$server = $lma_collector::params::elasticsearch_server,
$port = $lma_collector::params::elasticsearch_port,
$server,
$port,
) inherits lma_collector::params {
include lma_collector::service::log
validate_string($server)
validate_integer($port)
heka::encoder::es_json { 'elasticsearch':
config_dir => $lma_collector::params::log_config_dir,

View File

@ -17,12 +17,15 @@ class lma_collector::influxdb (
$user,
$password,
$server,
$port = $lma_collector::params::influxdb_port,
$port,
$tag_fields = $lma_collector::params::influxdb_tag_fields,
$time_precision = $lma_collector::params::influxdb_time_precision,
) inherits lma_collector::params {
include lma_collector::service::metric
validate_string($server, $user, $password)
validate_integer($port)
$lua_modules_dir = $lma_collector::params::lua_modules_dir
validate_string($database)

View File

@ -150,11 +150,8 @@ class lma_collector::params {
$worker_report_interval = 60
$worker_downtime_factor = 2
$elasticsearch_server = false
$elasticsearch_port = '9200'
$elasticsearch_fields = ['Timestamp', 'Type', 'Logger', 'Severity', 'Payload', 'Pid', 'Hostname', 'DynamicFields']
$influxdb_port = '8086'
$influxdb_timeout = 5
$influxdb_tag_fields = []
$influxdb_time_precision = 'ms'

View File

@ -20,7 +20,7 @@ describe 'lma_collector::elasticsearch' do
end
describe 'with localhost server' do
let(:params) {{ :server => 'localhost' }}
let(:params) {{ :server => 'localhost', :port => 9200 }}
it { is_expected.to contain_heka__output__elasticsearch('elasticsearch') }
it { is_expected.to contain_heka__encoder__es_json('elasticsearch') }
end

View File

@ -20,8 +20,8 @@ describe 'lma_collector::influxdb' do
end
describe 'with mandatory parameters' do
let(:params) {{ :server => 'localhost', :user => 'lma', :password =>
'lma', :database => 'lma' }}
let(:params) {{ :server => 'localhost', :port => 8086, :user => 'lma',
:password => 'lma', :database => 'lma' }}
it { is_expected.to contain_heka__output__http('influxdb') }
it { is_expected.to contain_heka__encoder__payload('influxdb') }
it { is_expected.to contain_heka__filter__sandbox('influxdb_accumulator') }
@ -29,8 +29,9 @@ describe 'lma_collector::influxdb' do
end
describe 'with tag_fields parameter' do
let(:params) {{ :server => 'localhost', :user => 'lma', :password =>
'lma', :database => 'lma', :tag_fields => ['foo', 'zzz'] }}
let(:params) {{ :server => 'localhost', :port => 8086, :user => 'lma',
:password => 'lma', :database => 'lma',
:tag_fields => ['foo', 'zzz'] }}
it { is_expected.to contain_heka__output__http('influxdb') }
it { is_expected.to contain_heka__encoder__payload('influxdb') }
it { is_expected.to contain_heka__filter__sandbox('influxdb_accumulator').with_config({