Partially add support for RedHat plateform
This commit is contained in:
parent
44d74d5742
commit
921cb3e64e
@ -16,7 +16,8 @@ class ceilometer::api(
|
||||
validate_string($keystone_password)
|
||||
|
||||
package { 'ceilometer-api':
|
||||
ensure => installed
|
||||
ensure => installed,
|
||||
name => $::ceilometer::params::api_package_name,
|
||||
}
|
||||
|
||||
if $enabled {
|
||||
|
@ -25,7 +25,7 @@ class ceilometer (
|
||||
system => true,
|
||||
require => [
|
||||
Group['ceilometer'],
|
||||
Package[$::ceilometer::params::common_package_name]
|
||||
Package['ceilometer-common']
|
||||
],
|
||||
}
|
||||
|
||||
|
@ -1,24 +1,44 @@
|
||||
# Ceilometer::Params class
|
||||
#
|
||||
#
|
||||
class ceilometer::params {
|
||||
$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-ceilometer'
|
||||
|
||||
$agent_central_service_name = 'ceilometer-agent-central'
|
||||
$agent_compute_service_name = 'ceilometer-agent-compute'
|
||||
$api_service_name = 'ceilometer-api'
|
||||
$collector_service_name = 'ceilometer-collector'
|
||||
$username = 'ceilometer'
|
||||
$groupname = 'ceilometer'
|
||||
$cinder_conf = '/etc/ceilometer/ceilometer.conf'
|
||||
$dbsync_command = "ceilometer-dbsync --config-file=${cinder_conf}"
|
||||
$log_dir = '/var/log/ceilometer'
|
||||
|
||||
$dbsync_command =
|
||||
'ceilometer-dbsync --config-file=/etc/ceilometer/ceilometer.conf'
|
||||
case $::osfamily {
|
||||
'RedHat': {
|
||||
# package names
|
||||
$agent_central_package_name = 'openstack-ceilometer-central'
|
||||
$agent_compute_package_name = 'openstack-ceilometer-compute'
|
||||
$api_package_name = 'openstack-ceilometer-api'
|
||||
$collector_package_name = 'openstack-ceilometer-collector'
|
||||
$common_package_name = 'openstack-ceilometer-common'
|
||||
$client_package_name = 'python-ceilometerclient'
|
||||
# service names
|
||||
$agent_central_service_name = 'openstack-ceilometer-central'
|
||||
$agent_compute_service_name = 'openstack-ceilometer-compute'
|
||||
$api_service_name = 'openstack-ceilometer-api'
|
||||
$collector_service_name = 'openstack-ceilometer-collector'
|
||||
|
||||
$log_dir = '/var/log/ceilometer'
|
||||
|
||||
$username = 'ceilometer'
|
||||
$groupname = 'ceilometer'
|
||||
}
|
||||
'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-ceilometer'
|
||||
# service names
|
||||
$agent_central_service_name = 'ceilometer-agent-central'
|
||||
$agent_compute_service_name = 'ceilometer-agent-compute'
|
||||
$api_service_name = 'ceilometer-api'
|
||||
$collector_service_name = 'ceilometer-collector'
|
||||
}
|
||||
default: {
|
||||
fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, module ${module_name} only support osfamily RedHat and Debian")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,20 +17,21 @@ describe 'ceilometer::api' do
|
||||
}
|
||||
end
|
||||
|
||||
context 'with all parameters' do
|
||||
shared_examples_for 'ceilometer-api' do
|
||||
|
||||
it { should include_class('ceilometer::params') }
|
||||
|
||||
it 'installs ceilometer-api package' do
|
||||
should contain_package('ceilometer-api').with(
|
||||
:ensure => 'installed'
|
||||
:ensure => 'installed',
|
||||
:name => platform_params[:api_package_name]
|
||||
)
|
||||
end
|
||||
|
||||
it 'configures ceilometer-api service' do
|
||||
should contain_service('ceilometer-api').with(
|
||||
:ensure => 'running',
|
||||
:name => 'ceilometer-api',
|
||||
:name => platform_params[:api_service_name],
|
||||
:enable => true,
|
||||
:hasstatus => true,
|
||||
:hasrestart => true,
|
||||
@ -39,7 +40,7 @@ describe 'ceilometer::api' do
|
||||
)
|
||||
end
|
||||
|
||||
it 'configures ceilometer with keystone' do
|
||||
it 'configures keystone authentication middleware' do
|
||||
should contain_ceilometer_config('keystone_authtoken/auth_host').with_value( params[:keystone_host] )
|
||||
should contain_ceilometer_config('keystone_authtoken/auth_port').with_value( params[:keystone_port] )
|
||||
should contain_ceilometer_config('keystone_authtoken/auth_protocol').with_value( params[:keystone_protocol] )
|
||||
@ -48,4 +49,30 @@ describe 'ceilometer::api' do
|
||||
should contain_ceilometer_config('keystone_authtoken/admin_password').with_value( params[:keystone_password] )
|
||||
end
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian' }
|
||||
end
|
||||
|
||||
let :platform_params do
|
||||
{ :api_package_name => 'ceilometer-api',
|
||||
:api_service_name => 'ceilometer-api' }
|
||||
end
|
||||
|
||||
it_configures 'ceilometer-api'
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'RedHat' }
|
||||
end
|
||||
|
||||
let :platform_params do
|
||||
{ :api_package_name => 'openstack-ceilometer-api',
|
||||
:api_service_name => 'openstack-ceilometer-api' }
|
||||
end
|
||||
|
||||
it_configures 'ceilometer-api'
|
||||
end
|
||||
end
|
||||
|
@ -15,7 +15,7 @@ describe 'ceilometer' do
|
||||
}
|
||||
end
|
||||
|
||||
context 'with all parameters' do
|
||||
shared_examples_for 'ceilometer' do
|
||||
|
||||
it { should include_class('ceilometer::params') }
|
||||
|
||||
@ -42,7 +42,7 @@ describe 'ceilometer' do
|
||||
:owner => 'ceilometer',
|
||||
:group => 'ceilometer',
|
||||
:mode => '0750',
|
||||
:require => ['Package[ceilometer-common]', 'User[ceilometer]']
|
||||
:require => ['Package[ceilometer-common]','User[ceilometer]']
|
||||
)
|
||||
end
|
||||
|
||||
@ -59,7 +59,7 @@ describe 'ceilometer' do
|
||||
it 'installs ceilometer common package' do
|
||||
should contain_package('ceilometer-common').with(
|
||||
:ensure => 'present',
|
||||
:name => 'ceilometer-common'
|
||||
:name => platform_params[:common_package_name]
|
||||
)
|
||||
end
|
||||
|
||||
@ -88,4 +88,29 @@ describe 'ceilometer' do
|
||||
should contain_ceilometer_config('DEFAULT/notification_topics').with_value('notifications,glance_notifications')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
{:osfamily => 'Debian'}
|
||||
end
|
||||
|
||||
let :platform_params do
|
||||
{ :common_package_name => 'ceilometer-common' }
|
||||
end
|
||||
|
||||
it_configures 'ceilometer'
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
{:osfamily => 'RedHat'}
|
||||
end
|
||||
|
||||
let :platform_params do
|
||||
{ :common_package_name => 'openstack-ceilometer-common' }
|
||||
end
|
||||
|
||||
it_configures 'ceilometer'
|
||||
end
|
||||
end
|
||||
|
@ -1 +1,5 @@
|
||||
require 'puppetlabs_spec_helper/module_spec_helper'
|
||||
|
||||
RSpec.configure do |c|
|
||||
c.alias_it_should_behave_like_to :it_configures, 'configures'
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user