diff --git a/manifests/alarm/evaluator.pp b/manifests/alarm/evaluator.pp index 16cc0a12e..262153491 100644 --- a/manifests/alarm/evaluator.pp +++ b/manifests/alarm/evaluator.pp @@ -26,14 +26,9 @@ Ceilometer_config<||> ~> Service['ceilometer-alarm-evaluator'] - Package['ceilometer-alarm'] -> Service['ceilometer-alarm-evaluator'] - - if !defined(Package['ceilometer-alarm']){ - package { 'ceilometer-alarm': - ensure => installed, - name => $::ceilometer::params::alarm_package_name, - } - } + 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) if $enabled { $service_ensure = 'running' diff --git a/manifests/alarm/notifier.pp b/manifests/alarm/notifier.pp index 8ed81a6f5..1b09baaf1 100644 --- a/manifests/alarm/notifier.pp +++ b/manifests/alarm/notifier.pp @@ -27,14 +27,9 @@ Ceilometer_config<||> ~> Service['ceilometer-alarm-notifier'] - Package['ceilometer-alarm'] -> Service['ceilometer-alarm-notifier'] - - if !defined(Package['ceilometer-alarm']){ - package { 'ceilometer-alarm': - ensure => installed, - name => $::ceilometer::params::alarm_package_name, - } - } + 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) if $enabled { $service_ensure = 'running' diff --git a/manifests/params.pp b/manifests/params.pp index b0d2adcd2..0024d8554 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -13,7 +13,7 @@ $agent_compute_package_name = 'openstack-ceilometer-compute' $api_package_name = 'openstack-ceilometer-api' $collector_package_name = 'openstack-ceilometer-collector' - $alarm_package_name = 'openstack-ceilometer-alarm' + $alarm_package_name = ['openstack-ceilometer-alarm'] $common_package_name = 'openstack-ceilometer-common' $client_package_name = 'python-ceilometerclient' # service names @@ -36,13 +36,13 @@ } 'Debian': { # package names - $agent_central_package_name = 'ceilometer-agent-central' - $agent_compute_package_name = 'ceilometer-agent-compute' - $api_package_name = 'ceilometer-api' - $collector_package_name = 'ceilometer-collector' - $common_package_name = 'ceilometer-common' - $client_package_name = 'python-ceilometerclient' - $alarm_package_name = ['ceilometer-alarm-evaluator', 'ceilometer-alarm-notifier' ] + $agent_central_package_name = 'ceilometer-agent-central' + $agent_compute_package_name = 'ceilometer-agent-compute' + $api_package_name = 'ceilometer-api' + $collector_package_name = 'ceilometer-collector' + $common_package_name = 'ceilometer-common' + $client_package_name = 'python-ceilometerclient' + $alarm_package_name = ['ceilometer-alarm-notifier','ceilometer-alarm-evaluator'] # service names $agent_central_service_name = 'ceilometer-agent-central' $agent_compute_service_name = 'ceilometer-agent-compute' @@ -51,9 +51,9 @@ $alarm_notifier_service_name = 'ceilometer-alarm-notifier' $alarm_evaluator_service_name = 'ceilometer-alarm-evaluator' # db packages - $psycopg_package_name = 'python-psycopg2' - $pymongo_package_name = 'python-pymongo' - $sqlite_package_name = 'python-pysqlite2' + $psycopg_package_name = 'python-psycopg2' + $pymongo_package_name = 'python-pymongo' + $sqlite_package_name = 'python-pysqlite2' # Operating system specific case $::operatingsystem { diff --git a/spec/classes/ceilometer_alarm_evaluator_spec.rb b/spec/classes/ceilometer_alarm_evaluator_spec.rb index 6d536d724..d017695e9 100644 --- a/spec/classes/ceilometer_alarm_evaluator_spec.rb +++ b/spec/classes/ceilometer_alarm_evaluator_spec.rb @@ -19,10 +19,10 @@ it { should contain_class('ceilometer::params') } it 'installs ceilometer-alarm package' do - should contain_package('ceilometer-alarm').with( - :ensure => 'installed', - :name => platform_params[:alarm_package_name], - :before => 'Service[ceilometer-alarm-evaluator]' + should contain_package(platform_params[:alarm_evaluator_package_name]).with_before('Service[ceilometer-alarm-evaluator]') + should contain_package(platform_params[:alarm_evaluator_package_name]).with( + :ensure => 'present', + :name => platform_params[:alarm_evaluator_package_name] ) end @@ -46,8 +46,8 @@ it 'configures alarm evaluator' do should contain_ceilometer_config('alarm/evaluation_interval').with_value( params[:evaluation_interval] ) 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 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] ) end context 'when overriding parameters' do @@ -79,8 +79,7 @@ end let :platform_params do - { :alarm_package_name => ['ceilometer-alarm-evaluator', - 'ceilometer-alarm-notifier' ], + { :alarm_evaluator_package_name => 'ceilometer-alarm-evaluator', :alarm_evaluator_service_name => 'ceilometer-alarm-evaluator' } end @@ -93,7 +92,7 @@ end let :platform_params do - { :alarm_package_name => 'openstack-ceilometer-alarm', + { :alarm_evaluator_package_name => 'openstack-ceilometer-alarm', :alarm_evaluator_service_name => 'openstack-ceilometer-alarm-evaluator' } end diff --git a/spec/classes/ceilometer_alarm_notifier_spec.rb b/spec/classes/ceilometer_alarm_notifier_spec.rb index 3eecb2287..6c40d433a 100644 --- a/spec/classes/ceilometer_alarm_notifier_spec.rb +++ b/spec/classes/ceilometer_alarm_notifier_spec.rb @@ -20,10 +20,10 @@ it { should contain_class('ceilometer::params') } it 'installs ceilometer-alarm package' do - should contain_package('ceilometer-alarm').with( - :ensure => 'installed', - :name => platform_params[:alarm_package_name], - :before => 'Service[ceilometer-alarm-notifier]' + should contain_package(platform_params[:alarm_notifier_package_name]).with_before('Service[ceilometer-alarm-notifier]') + should contain_package(platform_params[:alarm_notifier_package_name]).with( + :ensure => 'present', + :name => platform_params[:alarm_notifier_package_name] ) end @@ -72,8 +72,7 @@ end let :platform_params do - { :alarm_package_name => ['ceilometer-alarm-evaluator', - 'ceilometer-alarm-notifier' ], + { :alarm_notifier_package_name => 'ceilometer-alarm-notifier', :alarm_notifier_service_name => 'ceilometer-alarm-notifier' } end @@ -86,7 +85,7 @@ end let :platform_params do - { :alarm_package_name => 'openstack-ceilometer-alarm', + { :alarm_notifier_package_name => 'openstack-ceilometer-alarm', :alarm_notifier_service_name => 'openstack-ceilometer-alarm-notifier' } end