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

View File

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

View File

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

View File

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

View File

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

View File

@ -9,8 +9,9 @@ describe 'ceilometer::agent::compute' do
end end
let :params do let :params do
{ :enabled => true, { :enabled => true,
:manage_service => true } :manage_service => true,
:package_ensure => 'installed' }
end end
shared_examples_for 'ceilometer-agent-compute' do 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 { should contain_class('ceilometer::params') }
it 'installs ceilometer agent notification package' do 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 end
it 'configures notifications parameters in ceilometer.conf' do it 'configures notifications parameters in ceilometer.conf' do

View File

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

View File

@ -16,7 +16,9 @@ describe 'ceilometer::collector' do
it { should contain_class('ceilometer::params') } it { should contain_class('ceilometer::params') }
it 'installs ceilometer-collector package' do 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 end
it 'configures ceilometer-collector service' do it 'configures ceilometer-collector service' do