Skip to content

Commit

Permalink
Merge pull request #160 from eglynn/juno
Browse files Browse the repository at this point in the history
Automatic update :: puppet-ceilometer support for configuring coordination/backend_url
  • Loading branch information
xbezdick committed Dec 3, 2014
2 parents 9c02ad8 + 897ef71 commit 88fc03b
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Puppetfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ mod 'apache',
:git => 'https://github.com/puppetlabs/puppetlabs-apache.git'

mod 'ceilometer',
:commit => '741e89ae5b59e6284d677dd1c3cdf4154902a378',
:commit => 'ee2f3cd4498b2ef3a6633991206b7185c1d32897',
:git => 'https://github.com/stackforge/puppet-ceilometer.git'

mod 'certmonger',
Expand Down
9 changes: 9 additions & 0 deletions ceilometer/manifests/agent/central.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,16 @@
# (optional) ensure state for package.
# Defaults to 'present'
#
# [*coordination_url*]
# (optional) The url to use for distributed group membership coordination.
# Defaults to undef.
#

class ceilometer::agent::central (
$manage_service = true,
$enabled = true,
$package_ensure = 'present',
$coordination_url = undef,
) {

include ceilometer::params
Expand Down Expand Up @@ -47,4 +52,8 @@
hasrestart => true,
}

if $coordination_url {
ensure_resource('ceilometer_config', 'coordination/backend_url',
{'value' => $coordination_url})
}
}
12 changes: 11 additions & 1 deletion ceilometer/manifests/alarm/evaluator.pp
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,18 @@
# (optional) Record alarm change events
# Defaults to true.
#
# [*coordination_url*]
# (optional) The url to use for distributed group membership coordination.
# Defaults to undef.
#
class ceilometer::alarm::evaluator (
$manage_service = true,
$enabled = true,
$evaluation_interval = 60,
$evaluation_service = 'ceilometer.alarm.service.SingletonAlarmService',
$partition_rpc_topic = 'alarm_partition_coordination',
$record_history = true,
$coordination_url = undef,
) {

include ceilometer::params
Expand Down Expand Up @@ -67,5 +72,10 @@
'alarm/evaluation_service' : value => $evaluation_service;
'alarm/partition_rpc_topic' : value => $partition_rpc_topic;
'alarm/record_history' : value => $record_history;
}
}

if $coordination_url {
ensure_resource('ceilometer_config', 'coordination/backend_url',
{'value' => $coordination_url})
}
}
12 changes: 9 additions & 3 deletions ceilometer/spec/classes/ceilometer_agent_central_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
end

let :params do
{ :enabled => true,
:manage_service => true,
:package_ensure => 'latest' }
{ :enabled => true,
:manage_service => true,
:package_ensure => 'latest',
:coordination_url => 'redis://localhost:6379'
}
end

shared_examples_for 'ceilometer-agent-central' do
Expand Down Expand Up @@ -48,6 +50,10 @@
end
end

it 'configures central agent' do
should contain_ceilometer_config('coordination/backend_url').with_value( params[:coordination_url] )
end

context 'with disabled service managing' do
before do
params.merge!({
Expand Down
5 changes: 4 additions & 1 deletion ceilometer/spec/classes/ceilometer_alarm_evaluator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,22 @@
should contain_ceilometer_config('alarm/evaluation_service').with_value( params[:evaluation_service] )
should contain_ceilometer_config('alarm/partition_rpc_topic').with_value( params[:partition_rpc_topic] )
should contain_ceilometer_config('alarm/record_history').with_value( params[:record_history] )
should_not contain_ceilometer_config('coordination/backend_url')
end

context 'when overriding parameters' do
before do
params.merge!(:evaluation_interval => 80,
:partition_rpc_topic => 'alarm_partition_coordination',
:record_history => false,
:evaluation_service => 'ceilometer.alarm.service.SingletonTestAlarmService')
:evaluation_service => 'ceilometer.alarm.service.SingletonTestAlarmService',
:coordination_url => 'redis://localhost:6379')
end
it { should contain_ceilometer_config('alarm/evaluation_interval').with_value(params[:evaluation_interval]) }
it { should contain_ceilometer_config('alarm/evaluation_service').with_value(params[:evaluation_service]) }
it { should contain_ceilometer_config('alarm/record_history').with_value(params[:record_history]) }
it { should contain_ceilometer_config('alarm/partition_rpc_topic').with_value(params[:partition_rpc_topic]) }
it { should contain_ceilometer_config('coordination/backend_url').with_value( params[:coordination_url]) }
end

context 'when override the evaluation interval with a non numeric value' do
Expand Down

0 comments on commit 88fc03b

Please sign in to comment.