From 67e4879c75643aaa7f5e5f34b63de7c9e2defe2e Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Fri, 29 May 2020 12:00:14 +0900 Subject: [PATCH] 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 --- manifests/api.pp | 13 ++++++++++--- manifests/params.pp | 4 +--- ...-service_name-on-redhat-os-496a8320834e376c.yaml | 7 +++++++ spec/classes/barbican_api_spec.rb | 2 +- 4 files changed, 19 insertions(+), 7 deletions(-) create mode 100644 releasenotes/notes/use-actual-service_name-on-redhat-os-496a8320834e376c.yaml diff --git a/manifests/api.pp b/manifests/api.pp index eedbb714..0b37a380 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -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, diff --git a/manifests/params.pp b/manifests/params.pp index 4bcd7537..f841adb7 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -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' diff --git a/releasenotes/notes/use-actual-service_name-on-redhat-os-496a8320834e376c.yaml b/releasenotes/notes/use-actual-service_name-on-redhat-os-496a8320834e376c.yaml new file mode 100644 index 00000000..2cb52b9a --- /dev/null +++ b/releasenotes/notes/use-actual-service_name-on-redhat-os-496a8320834e376c.yaml @@ -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. diff --git a/spec/classes/barbican_api_spec.rb b/spec/classes/barbican_api_spec.rb index 301782d0..adb9ba5f 100644 --- a/spec/classes/barbican_api_spec.rb +++ b/spec/classes/barbican_api_spec.rb @@ -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'