Merge "Revert "Separate api and registry packages for Red Hat""

This commit is contained in:
Jenkins 2015-04-17 18:48:10 +00:00 committed by Gerrit Code Review
commit c0feafd0e9
9 changed files with 55 additions and 39 deletions

View File

@ -8,7 +8,9 @@
# (required) Password used to authentication.
#
# [*package_ensure*]
# (optional) Ensure state for package. Defaults to 'present'.
# (optional) Ensure state for package. On RedHat platforms this
# setting is ignored and the setting from the glance class is used
# because there is only one glance package. Defaults to 'present'.
#
# [*verbose*]
# (optional) Rather to log the glance api service at verbose level.
@ -237,12 +239,14 @@ class glance::api(
warning('The mysql_module parameter is deprecated. The latest 2.x mysql module will be used.')
}
ensure_packages([$glance::params::api_package_name],
{
ensure => $package_ensure,
tag => ['openstack'],
}
)
if ( $glance::params::api_package_name != $glance::params::registry_package_name ) {
ensure_packages([$glance::params::api_package_name],
{
ensure => $package_ensure,
tag => ['openstack'],
}
)
}
Package[$glance::params::api_package_name] -> File['/etc/glance/']
Package[$glance::params::api_package_name] -> Class['glance::policy']

View File

@ -2,7 +2,16 @@
#
# base glance config.
#
class glance {
# === parameters:
#
# [*package_ensure*]
# (Optional) Ensure state for package. On Ubuntu this setting
# is ignored since Ubuntu has separate API and registry packages.
# Defaults to 'present'
#
class glance(
$package_ensure = 'present'
) {
include ::glance::params
@ -12,4 +21,12 @@ class glance {
group => 'root',
mode => '0770',
}
if ( $glance::params::api_package_name == $glance::params::registry_package_name ) {
package { $glance::params::api_package_name :
ensure => $package_ensure,
name => $::glance::params::package_name,
tag => ['openstack'],
}
}
}

View File

@ -10,8 +10,8 @@ class glance::params {
case $::osfamily {
'RedHat': {
$api_package_name = 'openstack-glance-api'
$registry_package_name = 'openstack-glance-registry'
$api_package_name = 'openstack-glance'
$registry_package_name = 'openstack-glance'
$api_service_name = 'openstack-glance-api'
$registry_service_name = 'openstack-glance-registry'
$db_sync_command = 'glance-manage --config-file=/etc/glance/glance-registry.conf db_sync'

View File

@ -8,7 +8,9 @@
# (required) The keystone password for administrative user
#
# [*package_ensure*]
# (optional) Ensure state for package. Defaults to 'present'.
# (optional) Ensure state for package. Defaults to 'present'. On RedHat
# platforms this setting is ignored and the setting from the glance class is
# used because there is only one glance package.
#
# [*verbose*]
# (optional) Enable verbose logs (true|false). Defaults to false.
@ -160,12 +162,14 @@ class glance::registry(
warning('The mysql_module parameter is deprecated. The latest 2.x mysql module will be used.')
}
ensure_packages( [$glance::params::registry_package_name],
{
ensure => $package_ensure,
tag => ['openstack'],
}
)
if ( $glance::params::api_package_name != $glance::params::registry_package_name ) {
ensure_packages( [$glance::params::registry_package_name],
{
ensure => $package_ensure,
tag => ['openstack'],
}
)
}
Package[$glance::params::registry_package_name] -> File['/etc/glance/']
Package[$glance::params::registry_package_name] -> Glance_registry_config<||>

View File

@ -434,6 +434,8 @@ describe 'glance::api' do
end
let(:params) { default_params }
# We only test this on Debian platforms, since on RedHat there isn't a
# separate package for glance API.
['present', 'latest'].each do |package_ensure|
context "with package_ensure '#{package_ensure}'" do
let(:params) { default_params.merge({ :package_ensure => package_ensure }) }
@ -451,15 +453,9 @@ describe 'glance::api' do
end
let(:params) { default_params }
['present', 'latest'].each do |package_ensure|
context "with package_ensure '#{package_ensure}'" do
let(:params) { default_params.merge({ :package_ensure => package_ensure }) }
it { is_expected.to contain_package('openstack-glance-api').with(
:ensure => package_ensure,
:tag => ['openstack']
)}
end
end
it { is_expected.to contain_package('openstack-glance').with(
:tag => ['openstack'],
)}
end
describe 'on unknown platforms' do

View File

@ -59,7 +59,7 @@ describe 'glance::cache::cleaner' do
{ :osfamily => 'RedHat' }
end
include_examples 'glance cache cleaner'
it { is_expected.to contain_cron('glance-cache-cleaner').with(:require => 'Package[openstack-glance-api]')}
it { is_expected.to contain_cron('glance-cache-cleaner').with(:require => 'Package[openstack-glance]')}
end
end

View File

@ -59,7 +59,7 @@ describe 'glance::cache::pruner' do
{ :osfamily => 'RedHat' }
end
include_examples 'glance cache pruner'
it { is_expected.to contain_cron('glance-cache-pruner').with(:require => 'Package[openstack-glance-api]')}
it { is_expected.to contain_cron('glance-cache-pruner').with(:require => 'Package[openstack-glance]')}
end
end

View File

@ -347,6 +347,8 @@ describe 'glance::registry' do
{ :osfamily => 'Debian' }
end
# We only test this on Debian platforms, since on RedHat there isn't a
# separate package for glance registry.
['present', 'latest'].each do |package_ensure|
context "with package_ensure '#{package_ensure}'" do
let(:params) { default_params.merge({ :package_ensure => package_ensure }) }
@ -364,16 +366,7 @@ describe 'glance::registry' do
end
let(:params) { default_params }
['present', 'latest'].each do |package_ensure|
context "with package_ensure '#{package_ensure}'" do
let(:params) { default_params.merge({ :package_ensure => package_ensure }) }
it { is_expected.to contain_package('openstack-glance-registry').with(
:ensure => package_ensure,
:tag => ['openstack']
)}
end
end
it { is_expected.to contain_package('openstack-glance')}
end
describe 'on unknown platforms' do

View File

@ -49,7 +49,9 @@ describe 'glance' do
end
let(:params) { default_params }
it { is_expected.to_not contain_package('openstack-glance') }
it { is_expected.to contain_package('openstack-glance').with(
:tag => ['openstack'],
)}
end
end