Add package_ensure where missing

This adds package_ensure parameter to:
* ceilometer::agent::central
* ceilometer::agent::compute
* ceilometer::agent::notification
* ceilometer::api
* ceilometer::collector

Change-Id: I3a982882c37a24737d71f9af93d7aa0d7200bdf4
This commit is contained in:
Xav Paice 2014-09-02 20:59:29 +12:00
parent 065a353aae
commit 2743465bdc
10 changed files with 59 additions and 20 deletions

View File

@ -9,9 +9,15 @@
# (optional) Whether the service should be managed by Puppet.
# Defaults to true.
#
# [*package_ensure*]
# (optional) ensure state for package.
# Defaults to 'present'
#
class ceilometer::agent::central (
$manage_service = true,
$enabled = true,
$manage_service = true,
$enabled = true,
$package_ensure = 'present',
) {
include ceilometer::params
@ -20,7 +26,7 @@ class ceilometer::agent::central (
Package['ceilometer-agent-central'] -> Service['ceilometer-agent-central']
package { 'ceilometer-agent-central':
ensure => installed,
ensure => $package_ensure,
name => $::ceilometer::params::agent_central_package_name,
}

View File

@ -1,4 +1,4 @@
# The ceilometer::agent::compute class installs the ceilometer compute agent
#The ceilometer::agent::compute class installs the ceilometer compute agent
# Include this class on all nova compute nodes
#
# == Parameters
@ -10,9 +10,14 @@
# (optional) Whether the service should be managed by Puppet.
# Defaults to true.
#
# [*package_ensure*]
# (optional) ensure state for package.
# Defaults to 'present'
#
class ceilometer::agent::compute (
$manage_service = true,
$enabled = true,
$manage_service = true,
$enabled = true,
$package_ensure = 'present',
) inherits ceilometer {
include ceilometer::params
@ -21,7 +26,7 @@ class ceilometer::agent::compute (
Package['ceilometer-agent-compute'] -> Service['ceilometer-agent-compute']
package { 'ceilometer-agent-compute':
ensure => installed,
ensure => $package_ensure,
name => $::ceilometer::params::agent_compute_package_name,
}

View File

@ -39,20 +39,29 @@
# (optional) Save event details.
# Defaults to false
#
# [*package_ensure*]
# (optional) ensure state for package.
# Defaults to 'present'
#
class ceilometer::agent::notification (
$manage_service = true,
$enabled = true,
$ack_on_event_error = true,
$store_events = false
$store_events = false,
$package_ensure = 'present',
) {
include ceilometer::params
Ceilometer_config<||> ~> Service['ceilometer-agent-notification']
Package[$::ceilometer::params::agent_notification_package_name] -> Service['ceilometer-agent-notification']
ensure_packages([$::ceilometer::params::agent_notification_package_name])
Package[$::ceilometer::params::agent_notification_package_name] ->
Service['ceilometer-agent-notification']
ensure_resource('package', [$::ceilometer::params::agent_notification_package_name],
{ ensure => $package_ensure }
)
if $manage_service {
if $enabled {

View File

@ -47,10 +47,15 @@
# (optional) The ceilometer api port.
# Defaults to 8777
#
# [*package_ensure*]
# (optional) ensure state for package.
# Defaults to 'present'
#
class ceilometer::api (
$manage_service = true,
$enabled = true,
$package_ensure = 'present',
$keystone_host = '127.0.0.1',
$keystone_port = '35357',
$keystone_auth_admin_prefix = false,
@ -72,7 +77,7 @@ class ceilometer::api (
Package['ceilometer-api'] -> Ceilometer_config<||>
Package['ceilometer-api'] -> Service['ceilometer-api']
package { 'ceilometer-api':
ensure => installed,
ensure => $package_ensure,
name => $::ceilometer::params::api_package_name,
}

View File

@ -9,9 +9,14 @@
# (optional) Whether the service should be managed by Puppet.
# Defaults to true.
#
# [*package_ensure*]
# (optional) ensure state for package.
# Defaults to 'present'
#
class ceilometer::collector (
$manage_service = true,
$enabled = true,
$package_ensure = 'present',
) {
include ceilometer::params
@ -19,7 +24,9 @@ class ceilometer::collector (
Ceilometer_config<||> ~> Service['ceilometer-collector']
Package[$::ceilometer::params::collector_package_name] -> Service['ceilometer-collector']
ensure_packages([$::ceilometer::params::collector_package_name])
ensure_resource( 'package', [$::ceilometer::params::collector_package_name],
{ ensure => $package_ensure }
)
if $manage_service {
if $enabled {

View File

@ -8,7 +8,8 @@ describe 'ceilometer::agent::central' do
let :params do
{ :enabled => true,
:manage_service => true }
:manage_service => true,
:package_ensure => 'latest' }
end
shared_examples_for 'ceilometer-agent-central' do
@ -17,7 +18,7 @@ describe 'ceilometer::agent::central' do
it 'installs ceilometer-agent-central package' do
should contain_package('ceilometer-agent-central').with(
:ensure => 'installed',
:ensure => 'latest',
:name => platform_params[:agent_package_name],
:before => 'Service[ceilometer-agent-central]'
)

View File

@ -9,8 +9,9 @@ describe 'ceilometer::agent::compute' do
end
let :params do
{ :enabled => true,
:manage_service => true }
{ :enabled => true,
:manage_service => true,
:package_ensure => 'installed' }
end
shared_examples_for 'ceilometer-agent-compute' do

View File

@ -38,7 +38,9 @@ describe 'ceilometer::agent::notification' do
it { should contain_class('ceilometer::params') }
it 'installs ceilometer agent notification package' do
should contain_package(platform_params[:agent_notification_package_name])
should contain_package(platform_params[:agent_notification_package_name]).with(
:ensure => 'present'
)
end
it 'configures notifications parameters in ceilometer.conf' do

View File

@ -16,7 +16,8 @@ describe 'ceilometer::api' do
:keystone_password => 'ceilometer-passw0rd',
:keystone_tenant => 'services',
:host => '0.0.0.0',
:port => '8777'
:port => '8777',
:package_ensure => 'latest',
}
end
@ -31,7 +32,7 @@ describe 'ceilometer::api' do
it 'installs ceilometer-api package' do
should contain_package('ceilometer-api').with(
:ensure => 'installed',
:ensure => 'latest',
:name => platform_params[:api_package_name]
)
end

View File

@ -16,7 +16,9 @@ describe 'ceilometer::collector' do
it { should contain_class('ceilometer::params') }
it 'installs ceilometer-collector package' do
should contain_package(platform_params[:collector_package_name])
should contain_package(platform_params[:collector_package_name]).with(
:ensure => 'present'
)
end
it 'configures ceilometer-collector service' do