Drop support for standalone api service in CentOS/Ubuntu
Aodh no longer provides standalone api service and we should use httpd+wsgi to server api in CentOS and Ubuntu. This patch removes support for stnadalone api service in CentOS and Ubuntu and deprecates several parameters only used in standalone setup. Note that standalone service is still used in Debian since it provides services based on uwsgi, so the support is not dropped in Debian. Change-Id: I576b029fa3b0e765a9affd175f4113941d59abc7
This commit is contained in:
parent
f9b9656b17
commit
7ce34f01b6
|
@ -81,7 +81,8 @@ class aodh::api (
|
||||||
}
|
}
|
||||||
|
|
||||||
if $manage_service {
|
if $manage_service {
|
||||||
if $service_name == $::aodh::params::api_service_name {
|
$api_service_name = $::aodh::params::api_service_name
|
||||||
|
if $api_service_name != 'httpd' and $service_name == $api_service_name {
|
||||||
if $enabled {
|
if $enabled {
|
||||||
$service_ensure = 'running'
|
$service_ensure = 'running'
|
||||||
} else {
|
} else {
|
||||||
|
@ -90,7 +91,7 @@ class aodh::api (
|
||||||
|
|
||||||
service { 'aodh-api':
|
service { 'aodh-api':
|
||||||
ensure => $service_ensure,
|
ensure => $service_ensure,
|
||||||
name => $::aodh::params::api_service_name,
|
name => $api_service_name,
|
||||||
enable => $enabled,
|
enable => $enabled,
|
||||||
hasstatus => true,
|
hasstatus => true,
|
||||||
hasrestart => true,
|
hasrestart => true,
|
||||||
|
@ -98,19 +99,20 @@ class aodh::api (
|
||||||
}
|
}
|
||||||
} elsif $service_name == 'httpd' {
|
} elsif $service_name == 'httpd' {
|
||||||
include apache::params
|
include apache::params
|
||||||
service { 'aodh-api':
|
|
||||||
ensure => 'stopped',
|
|
||||||
name => $::aodh::params::api_service_name,
|
|
||||||
enable => false,
|
|
||||||
tag => 'aodh-service',
|
|
||||||
}
|
|
||||||
Service <| title == 'httpd' |> { tag +> 'aodh-service' }
|
Service <| title == 'httpd' |> { tag +> 'aodh-service' }
|
||||||
|
|
||||||
# we need to make sure aodh-api/eventlet is stopped before trying to start apache
|
if $api_service_name != 'httpd' {
|
||||||
Service['aodh-api'] -> Service[$service_name]
|
service { 'aodh-api':
|
||||||
|
ensure => 'stopped',
|
||||||
|
name => $api_service_name,
|
||||||
|
enable => false,
|
||||||
|
tag => 'aodh-service',
|
||||||
|
}
|
||||||
|
# we need to make sure aodh-api/eventlet is stopped before trying to start apache
|
||||||
|
Service['aodh-api'] -> Service[$service_name]
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
fail("Invalid service_name. Either aodh/openstack-aodh-api for running \
|
fail('Invalid service_name.')
|
||||||
as a standalone service, or httpd for being run by a httpd server")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ class aodh::params {
|
||||||
'RedHat': {
|
'RedHat': {
|
||||||
$common_package_name = 'openstack-aodh-common'
|
$common_package_name = 'openstack-aodh-common'
|
||||||
$api_package_name = 'openstack-aodh-api'
|
$api_package_name = 'openstack-aodh-api'
|
||||||
$api_service_name = 'openstack-aodh-api'
|
$api_service_name = 'httpd'
|
||||||
$notifier_package_name = 'openstack-aodh-notifier'
|
$notifier_package_name = 'openstack-aodh-notifier'
|
||||||
$notifier_service_name = 'openstack-aodh-notifier'
|
$notifier_service_name = 'openstack-aodh-notifier'
|
||||||
$evaluator_package_name = 'openstack-aodh-evaluator'
|
$evaluator_package_name = 'openstack-aodh-evaluator'
|
||||||
|
@ -28,7 +28,14 @@ class aodh::params {
|
||||||
'Debian': {
|
'Debian': {
|
||||||
$common_package_name = 'aodh-common'
|
$common_package_name = 'aodh-common'
|
||||||
$api_package_name = 'aodh-api'
|
$api_package_name = 'aodh-api'
|
||||||
$api_service_name = 'aodh-api'
|
case $::operatingsystem {
|
||||||
|
'Ubuntu': {
|
||||||
|
$api_service_name = 'httpd'
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
$api_service_name = 'aodh-api'
|
||||||
|
}
|
||||||
|
}
|
||||||
$notifier_package_name = 'aodh-notifier'
|
$notifier_package_name = 'aodh-notifier'
|
||||||
$notifier_service_name = 'aodh-notifier'
|
$notifier_service_name = 'aodh-notifier'
|
||||||
$evaluator_package_name = 'aodh-evaluator'
|
$evaluator_package_name = 'aodh-evaluator'
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
upgrade:
|
||||||
|
- |
|
||||||
|
The ``aodh::api`` class no longer supports standalone api service in
|
||||||
|
CentOS and Ubuntu, because these 2 distros don't provide standalone api
|
||||||
|
service and require that wsgi is used to run the api service.
|
|
@ -3,7 +3,8 @@ require 'spec_helper'
|
||||||
describe 'aodh::api' do
|
describe 'aodh::api' do
|
||||||
|
|
||||||
let :pre_condition do
|
let :pre_condition do
|
||||||
"class { 'aodh': }
|
"include apache
|
||||||
|
class { 'aodh': }
|
||||||
include aodh::db
|
include aodh::db
|
||||||
class { 'aodh::keystone::authtoken':
|
class { 'aodh::keystone::authtoken':
|
||||||
password => 'a_big_secret',
|
password => 'a_big_secret',
|
||||||
|
@ -17,7 +18,7 @@ describe 'aodh::api' do
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
shared_examples 'aodh::api' do
|
shared_examples 'aodh-api' do
|
||||||
|
|
||||||
it { is_expected.to contain_class('aodh::deps') }
|
it { is_expected.to contain_class('aodh::deps') }
|
||||||
it { is_expected.to contain_class('aodh::params') }
|
it { is_expected.to contain_class('aodh::params') }
|
||||||
|
@ -40,27 +41,6 @@ describe 'aodh::api' do
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
[{:enabled => true}, {:enabled => false}].each do |param_hash|
|
|
||||||
context "when service should be #{param_hash[:enabled] ? 'enabled' : 'disabled'}" do
|
|
||||||
before do
|
|
||||||
params.merge!(param_hash)
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'configures aodh-api service' do
|
|
||||||
is_expected.to contain_service('aodh-api').with(
|
|
||||||
:ensure => (params[:manage_service] && params[:enabled]) ? 'running' : 'stopped',
|
|
||||||
:name => platform_params[:api_service_name],
|
|
||||||
:enable => params[:enabled],
|
|
||||||
:hasstatus => true,
|
|
||||||
:hasrestart => true,
|
|
||||||
:tag => 'aodh-service',
|
|
||||||
)
|
|
||||||
end
|
|
||||||
it { is_expected.to contain_service('aodh-api').that_subscribes_to('Anchor[aodh::service::begin]')}
|
|
||||||
it { is_expected.to contain_service('aodh-api').that_notifies('Anchor[aodh::service::end]')}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'with sync_db set to true' do
|
context 'with sync_db set to true' do
|
||||||
before do
|
before do
|
||||||
params.merge!(
|
params.merge!(
|
||||||
|
@ -104,6 +84,64 @@ describe 'aodh::api' do
|
||||||
|
|
||||||
it { is_expected.to contain_aodh_config('api/gnocchi_external_project_owner').with_value('gnocchi-project') }
|
it { is_expected.to contain_aodh_config('api/gnocchi_external_project_owner').with_value('gnocchi-project') }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when service_name is not valid' do
|
||||||
|
before do
|
||||||
|
params.merge!({ :service_name => 'foobar' })
|
||||||
|
end
|
||||||
|
|
||||||
|
let :pre_condition do
|
||||||
|
"include apache
|
||||||
|
include aodh::db
|
||||||
|
class { 'aodh': }
|
||||||
|
class { 'aodh::keystone::authtoken':
|
||||||
|
password => 'a_big_secret',
|
||||||
|
}"
|
||||||
|
end
|
||||||
|
|
||||||
|
it_raises 'a Puppet::Error', /Invalid service_name/
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
shared_examples_for 'aodh-api without standalone service' do
|
||||||
|
|
||||||
|
let :pre_condition do
|
||||||
|
"include apache
|
||||||
|
include aodh::db
|
||||||
|
class { 'aodh': }
|
||||||
|
class {'aodh::keystone::authtoken':
|
||||||
|
password => 'password',
|
||||||
|
}"
|
||||||
|
end
|
||||||
|
|
||||||
|
it { is_expected.to_not contain_service('aodh-api') }
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
shared_examples 'aodh-api with standalone service' do
|
||||||
|
|
||||||
|
[{:enabled => true}, {:enabled => false}].each do |param_hash|
|
||||||
|
context "when service should be #{param_hash[:enabled] ? 'enabled' : 'disabled'}" do
|
||||||
|
before do
|
||||||
|
params.merge!(param_hash)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'configures aodh-api service' do
|
||||||
|
is_expected.to contain_service('aodh-api').with(
|
||||||
|
:ensure => (params[:manage_service] && params[:enabled]) ? 'running' : 'stopped',
|
||||||
|
:name => platform_params[:api_service_name],
|
||||||
|
:enable => params[:enabled],
|
||||||
|
:hasstatus => true,
|
||||||
|
:hasrestart => true,
|
||||||
|
:tag => 'aodh-service',
|
||||||
|
)
|
||||||
|
end
|
||||||
|
it { is_expected.to contain_service('aodh-api').that_subscribes_to('Anchor[aodh::service::begin]')}
|
||||||
|
it { is_expected.to contain_service('aodh-api').that_notifies('Anchor[aodh::service::end]')}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context 'with disabled service managing' do
|
context 'with disabled service managing' do
|
||||||
before do
|
before do
|
||||||
params.merge!({
|
params.merge!({
|
||||||
|
@ -139,23 +177,6 @@ describe 'aodh::api' do
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when service_name is not valid' do
|
|
||||||
before do
|
|
||||||
params.merge!({ :service_name => 'foobar' })
|
|
||||||
end
|
|
||||||
|
|
||||||
let :pre_condition do
|
|
||||||
"include apache
|
|
||||||
include aodh::db
|
|
||||||
class { 'aodh': }
|
|
||||||
class { 'aodh::keystone::authtoken':
|
|
||||||
password => 'a_big_secret',
|
|
||||||
}"
|
|
||||||
end
|
|
||||||
|
|
||||||
it_raises 'a Puppet::Error', /Invalid service_name/
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
on_supported_os({
|
on_supported_os({
|
||||||
|
@ -172,15 +193,25 @@ describe 'aodh::api' do
|
||||||
let(:platform_params) do
|
let(:platform_params) do
|
||||||
case facts[:osfamily]
|
case facts[:osfamily]
|
||||||
when 'Debian'
|
when 'Debian'
|
||||||
{ :api_package_name => 'aodh-api',
|
if facts[:operatingsystem] == 'Ubuntu'
|
||||||
:api_service_name => 'aodh-api' }
|
{ :api_package_name => 'aodh-api',
|
||||||
|
:api_service_name => 'httpd' }
|
||||||
|
else
|
||||||
|
{ :api_package_name => 'aodh-api',
|
||||||
|
:api_service_name => 'aodh-api' }
|
||||||
|
end
|
||||||
when 'RedHat'
|
when 'RedHat'
|
||||||
{ :api_package_name => 'openstack-aodh-api',
|
{ :api_package_name => 'openstack-aodh-api',
|
||||||
:api_service_name => 'openstack-aodh-api' }
|
:api_service_name => 'httpd' }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it_behaves_like 'aodh::api'
|
if facts[:osfamily] == 'Debian' and facts[:operatingsystem] != 'Ubuntu'
|
||||||
|
it_behaves_like 'aodh-api with standalone service'
|
||||||
|
else
|
||||||
|
it_behaves_like 'aodh-api without standalone service'
|
||||||
|
end
|
||||||
|
it_behaves_like 'aodh-api'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue