Accept actual service name for api service name

Currently the other puppet modules accept actual service name on the
platfomr for api service_name, while puppet-barbican always require
'barbican-api' and doesn't accept 'openstack-barbican-api' even in
Red Hat based OS.

This patch makes sure that we accept actual service name for api
service name, so that the accepted values are consistent among all
puppet modules.

Change-Id: I3ff64113e19a7c784d03afe3cb34865b88f8e39a
This commit is contained in:
Takashi Kajinami 2020-05-29 12:00:14 +09:00
parent 285e0874b5
commit 67e4879c75
4 changed files with 19 additions and 7 deletions

View File

@ -224,7 +224,7 @@
# service, and you must use another class to configure that
# web service. For example, use class { 'barbican::wsgi::apache'...}
# to make barbican-api be a web app using apache mod_wsgi.
# Defaults to 'barbican-api'
# Defaults to $::barbican::params::api_service_name
#
# [*use_ssl*]
# (optional) Enable SSL on the API server
@ -300,7 +300,7 @@ class barbican::api (
$ca_file = $::os_service_default,
$cert_file = $::os_service_default,
$key_file = $::os_service_default,
$service_name = 'barbican-api',
$service_name = $::barbican::params::api_service_name,
$enable_proxy_headers_parsing = $::os_service_default,
$max_request_body_size = $::os_service_default,
) inherits barbican::params {
@ -466,10 +466,17 @@ class barbican::api (
include barbican::db::sync
}
if $service_name == 'barbican-api' {
if $service_name == 'barbican-api' or $service_name == $::barbican::params::api_service_name {
if $::os_package_type == 'ubuntu' {
fail('With Ubuntu packages the service_name must be set to httpd as there is no eventlet init script.')
}
if $::osfamily == 'RedHat' and $service_name == 'barbican-api' {
warning('The usage of barbican-api as service_name in Red Hat based OS is \
deprecated and will be removed in a future release. Use openstack-barbican-api instead.')
}
service { 'barbican-api':
ensure => $service_ensure,
name => $::barbican::params::api_service_name,

View File

@ -21,9 +21,7 @@ class barbican::params {
$httpd_config_file = '/etc/httpd/conf.d/barbican-api.conf'
}
'Debian': {
if ($::os_package_type == 'debian') {
$api_service_name = 'barbican-api'
}
$api_service_name = 'barbican-api'
$api_package_name = 'barbican-api'
$worker_package_name = 'barbican-worker'
$worker_service_name = 'barbican-worker'

View File

@ -0,0 +1,7 @@
---
deprecations:
- |
The usage of ``barbican-api`` as service_name in Red Hat based OS is
deprecated and will be removed in a future release. Use
``openstack-barbican-api``, which is consistent with the actual service
name.

View File

@ -362,7 +362,7 @@ describe 'barbican::api' do
case facts[:osfamily]
when 'RedHat'
let (:platform_params) do
{ :service_name => 'barbican-api' }
{ :service_name => 'openstack-barbican-api' }
end
it_behaves_like 'barbican api redhat'
when 'Debian'