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'