Skip to content

Commit

Permalink
fix alarm_package_name for Debian/Ubuntu (only havana)
Browse files Browse the repository at this point in the history
  - Debian uses separate packages in havana
  - Ubuntu uses ceilometer-common which conflicts with init.pp
  - separate tests for Ubuntu/Debian (for alarm*)
  - Change-Id: I91098bd3f13ee4391dcf1b870705c0a0c5566acc
    introduced this troubles.

Change-Id: I8d396131386e5469eb6d7d43d7c6a7354abed31a
  • Loading branch information
trefzer committed Mar 1, 2014
1 parent fa5a6ee commit 7e4f4dc
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 12 deletions.
11 changes: 10 additions & 1 deletion manifests/alarm/evaluator.pp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,16 @@

Package[$::ceilometer::params::alarm_package_name] -> Service['ceilometer-alarm-evaluator']
Package[$::ceilometer::params::alarm_package_name] -> Package<| title == 'ceilometer-alarm' |>
ensure_packages($::ceilometer::params::alarm_package_name)

# Workaround for Ubuntu havana, where alarm_package_name = common_package_name
if ( $::ceilometer::params::common_package_name in $::ceilometer::params::alarm_package_name)
{
if ! defined(Package[$::ceilometer::params::common_package_name]) {
package{$::ceilometer::params::common_package_name : }
}
} else {
ensure_packages($::ceilometer::params::alarm_package_name)
}

if $enabled {
$service_ensure = 'running'
Expand Down
9 changes: 8 additions & 1 deletion manifests/alarm/notifier.pp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,14 @@

Package[$::ceilometer::params::alarm_package_name] -> Service['ceilometer-alarm-notifier']
Package[$::ceilometer::params::alarm_package_name] -> Package<| title == 'ceilometer-alarm' |>
ensure_packages($::ceilometer::params::alarm_package_name)
# Workaround for Ubuntu havana, where alarm_package_name = common_package_name
if ( $::ceilometer::params::common_package_name in $::ceilometer::params::alarm_package_name ) {
if ! defined(Package[$::ceilometer::params::common_package_name]) {
package{$::ceilometer::params::common_package_name : }
}
} else {
ensure_packages($::ceilometer::params::alarm_package_name)
}

if $enabled {
$service_ensure = 'running'
Expand Down
8 changes: 5 additions & 3 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,11 @@
mode => '0640',
}

package { 'ceilometer-common':
ensure => $package_ensure,
name => $::ceilometer::params::common_package_name,
if ! defined(Package['ceilometer-common']) {
package { 'ceilometer-common':
ensure => $package_ensure,
name => $::ceilometer::params::common_package_name,
}
}

Package['ceilometer-common'] -> Ceilometer_config<||>
Expand Down
7 changes: 4 additions & 3 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
$collector_package_name = 'ceilometer-collector'
$common_package_name = 'ceilometer-common'
$client_package_name = 'python-ceilometerclient'
$alarm_package_name = ['ceilometer-common']
# service names
$agent_central_service_name = 'ceilometer-agent-central'
$agent_compute_service_name = 'ceilometer-agent-compute'
Expand All @@ -58,10 +57,12 @@
# Operating system specific
case $::operatingsystem {
'Ubuntu': {
$libvirt_group = 'libvirtd'
$libvirt_group = 'libvirtd'
$alarm_package_name = ['ceilometer-common']
}
default: {
$libvirt_group = 'libvirt'
$libvirt_group = 'libvirt'
$alarm_package_name = ['ceilometer-alarm-notifier','ceilometer-alarm-evaluator']
}
}
}
Expand Down
19 changes: 17 additions & 2 deletions spec/classes/ceilometer_alarm_evaluator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,24 @@
end
end

context 'on Debian platforms' do
context 'on Debian operating system' do
let :facts do
{ :osfamily => 'Debian' }
{ :osfamily => 'Debian',
:operatingsystem => 'Debian' }
end

let :platform_params do
{ :alarm_evaluator_package_name => 'ceilometer-common',
:alarm_evaluator_service_name => 'ceilometer-alarm-evaluator' }
end

it_configures 'ceilometer-alarm-evaluator'
end

context 'on Ubuntu operating system' do
let :facts do
{ :osfamily => 'Debian',
:operatingsystem => 'Ubuntu' }
end

let :platform_params do
Expand Down
19 changes: 17 additions & 2 deletions spec/classes/ceilometer_alarm_notifier_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,24 @@

end

context 'on Debian platforms' do
context 'on Debian operating system' do
let :facts do
{ :osfamily => 'Debian' }
{ :osfamily => 'Debian',
:operatingsystem => 'Debian' }
end

let :platform_params do
{ :alarm_notifier_package_name => 'ceilometer-common',
:alarm_notifier_service_name => 'ceilometer-alarm-notifier' }
end

it_configures 'ceilometer-alarm-notifier'
end

context 'on Ubuntu operating system' do
let :facts do
{ :osfamily => 'Debian',
:operatingsystem => 'Ubuntu' }
end

let :platform_params do
Expand Down

0 comments on commit 7e4f4dc

Please sign in to comment.