Merge "Handle Centos/RHEL pymongo packages"

This commit is contained in:
Jenkins 2013-08-31 20:46:22 +00:00 committed by Gerrit Code Review
commit bfad5a3821
3 changed files with 127 additions and 2 deletions

View File

@ -26,10 +26,10 @@ class ceilometer::db (
$backend_package = 'python-psycopg2'
}
/^mongodb:\/\//: {
$backend_package = 'python-pymongo'
$backend_package = $::ceilometer::params::pymongo_package_name
}
/^sqlite:\/\//: {
$backend_package = 'python-pysqlite2'
$backend_package = $::ceilometer::params::sqlite_package_name
}
default: {
fail('Unsupported backend configured')

View File

@ -20,6 +20,17 @@ class ceilometer::params {
$agent_compute_service_name = 'openstack-ceilometer-compute'
$api_service_name = 'openstack-ceilometer-api'
$collector_service_name = 'openstack-ceilometer-collector'
# db packages
if $::operatingsystem == 'Fedora' and $::operatingsystemrelease >= 18 {
# name change in f18 : https://bugzilla.redhat.com/show_bug.cgi?id=954155
$pymongo_package_name = 'python-pymongo'
# fallback to stdlib version, not provided on fedora
$sqlite_package_name = undef
} else {
$pymongo_package_name = 'pymongo'
$sqlite_package_name = 'python-sqlite2'
}
}
'Debian': {
# package names
@ -34,6 +45,10 @@ class ceilometer::params {
$agent_compute_service_name = 'ceilometer-agent-compute'
$api_service_name = 'ceilometer-api'
$collector_service_name = 'ceilometer-collector'
# db packages
$pymongo_package_name = 'python-pymongo'
$sqlite_package_name = 'python-pysqlite2'
# Operating system specific
case $::operatingsystem {
'Ubuntu': {

View File

@ -0,0 +1,110 @@
require 'spec_helper'
describe 'ceilometer::db' do
# debian has "python-pymongo"
context 'on Debian platforms' do
let :facts do
{ :osfamily => 'Debian' }
end
let :params do
{ :database_connection => 'mongodb://localhost:1234/ceilometer' }
end
it { should include_class('ceilometer::params') }
it 'installs python-mongodb package' do
should contain_package('ceilometer-backend-package').with(
:ensure => 'present',
:name => 'python-pymongo')
end
end
# Fedora > 18 has python-pymongo too
context 'on Redhat platforms' do
let :facts do
{ :osfamily => 'Redhat',
:operatingsystem => 'Fedora',
:operatingsystemrelease => 18
}
end
let :params do
{ :database_connection => 'mongodb://localhost:1234/ceilometer' }
end
it { should include_class('ceilometer::params') }
it 'installs pymongo package' do
should contain_package('ceilometer-backend-package').with(
:ensure => 'present',
:name => 'python-pymongo')
end
end
# RHEL has pymongo
context 'on Redhat platforms' do
let :facts do
{ :osfamily => 'Redhat',
:operatingsystem => 'CentOS',
:operatingsystemrelease => 6.4
}
end
let :params do
{ :database_connection => 'mongodb://localhost:1234/ceilometer' }
end
it { should include_class('ceilometer::params') }
it 'installs pymongo package' do
should contain_package('ceilometer-backend-package').with(
:ensure => 'present',
:name => 'pymongo')
end
end
# RHEL has python-sqlite2
context 'on Redhat platforms' do
let :facts do
{ :osfamily => 'Redhat',
:operatingsystem => 'CentOS',
:operatingsystemrelease => 6.4
}
end
let :params do
{ :database_connection => 'sqlite:///var/lib/ceilometer.db' }
end
it { should include_class('ceilometer::params') }
it 'installs pymongo package' do
should contain_package('ceilometer-backend-package').with(
:ensure => 'present',
:name => 'python-sqlite2')
end
end
# debian has "python-pysqlite2"
context 'on Debian platforms' do
let :facts do
{ :osfamily => 'Debian' }
end
let :params do
{ :database_connection => 'sqlite:///var/lib/ceilometer.db' }
end
it { should include_class('ceilometer::params') }
it 'installs python-mongodb package' do
should contain_package('ceilometer-backend-package').with(
:ensure => 'present',
:name => 'python-pysqlite2')
end
end
end