Manage driver-agent package/service in CentOS

... because the independent driver-agent package was added to RDO[1].

[1] https://review.rdoproject.org/r/c/openstack/octavia-distgit/+/32779

Change-Id: I6d9e16d4a7c85a90c1388583a4d14ff21224345a
This commit is contained in:
Takashi Kajinami 2022-06-27 17:51:19 +09:00
parent 7685156256
commit c3916c7fe2
4 changed files with 51 additions and 46 deletions

View File

@ -89,30 +89,26 @@ class octavia::driver_agent (
include octavia::deps
include octavia::params
if $::octavia::params::driver_agent_package_name {
package { 'octavia-driver-agent':
ensure => $package_ensure,
name => $::octavia::params::driver_agent_package_name,
tag => ['openstack', 'octavia-package'],
}
package { 'octavia-driver-agent':
ensure => $package_ensure,
name => $::octavia::params::driver_agent_package_name,
tag => ['openstack', 'octavia-package'],
}
if $::octavia::params::driver_agent_service_name {
if $manage_service {
if $enabled {
$service_ensure = 'running'
} else {
$service_ensure = 'stopped'
}
if $manage_service {
if $enabled {
$service_ensure = 'running'
} else {
$service_ensure = 'stopped'
}
service { 'octavia-driver-agent':
ensure => $service_ensure,
name => $::octavia::params::driver_agent_service_name,
enable => $enabled,
hasstatus => true,
hasrestart => true,
tag => ['octavia-service']
}
service { 'octavia-driver-agent':
ensure => $service_ensure,
name => $::octavia::params::driver_agent_service_name,
enable => $enabled,
hasstatus => true,
hasrestart => true,
tag => ['octavia-service']
}
}

View File

@ -7,6 +7,7 @@ class octavia::params {
$worker_service_name = 'octavia-worker'
$health_manager_service_name = 'octavia-health-manager'
$housekeeping_service_name = 'octavia-housekeeping'
$driver_agent_service_name = 'octavia-driver-agent'
$client_package_name = 'python3-octaviaclient'
$ovn_provider_package_name = 'python3-ovn-octavia-provider'
$user = 'octavia'
@ -19,10 +20,9 @@ class octavia::params {
$worker_package_name = 'openstack-octavia-worker'
$health_manager_package_name = 'openstack-octavia-health-manager'
$housekeeping_package_name = 'openstack-octavia-housekeeping'
$driver_agent_package_name = false
$driver_agent_package_name = 'openstack-octavia-driver-agent'
$octavia_wsgi_script_path = '/var/www/cgi-bin/octavia'
$octavia_wsgi_script_source = '/usr/bin/octavia-wsgi'
$driver_agent_service_name = false
}
'Debian': {
$common_package_name = 'octavia-common'
@ -33,7 +33,6 @@ class octavia::params {
$driver_agent_package_name = 'octavia-driver-agent'
$octavia_wsgi_script_path = '/usr/lib/cgi-bin/octavia'
$octavia_wsgi_script_source = '/usr/bin/octavia-wsgi'
$driver_agent_service_name = 'octavia-driver-agent'
}
default: {
fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, \

View File

@ -0,0 +1,6 @@
---
features:
- |
The ``octavia::driver_agent`` class now supports managing the package and
the service required to run the ``octavia-driver-agent`` process in Cent OS
and RHEL.

View File

@ -9,6 +9,21 @@ describe 'octavia::driver_agent' do
shared_examples_for 'octavia-driver-agent' do
context 'with default parameters' do
it { is_expected.to contain_package('octavia-driver-agent').with(
:ensure => 'present',
:name => platform_params[:driver_agent_package_name],
:tag => ['openstack', 'octavia-package'],
) }
it { is_expected.to contain_service('octavia-driver-agent').with(
:ensure => 'running',
:name => platform_params[:driver_agent_service_name],
:enable => true,
:hasstatus => true,
:hasrestart => true,
:tag => ['octavia-service']
) }
it { is_expected.to contain_octavia_config('driver_agent/status_socket_path').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_octavia_config('driver_agent/stats_socket_path').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_octavia_config('driver_agent/get_socket_path').with_value('<SERVICE DEFAULT>') }
@ -56,25 +71,6 @@ describe 'octavia::driver_agent' do
end
end
shared_examples_for 'octavia-driver-agent on Debian' do
context 'with default parameters' do
it { is_expected.to contain_package('octavia-driver-agent').with(
:ensure => 'present',
:name => 'octavia-driver-agent',
:tag => ['openstack', 'octavia-package'],
) }
it { is_expected.to contain_service('octavia-driver-agent').with(
:ensure => 'running',
:name => 'octavia-driver-agent',
:enable => true,
:hasstatus => true,
:hasrestart => true,
:tag => ['octavia-service']
) }
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
@ -83,10 +79,18 @@ describe 'octavia::driver_agent' do
facts.merge!(OSDefaults.get_facts())
end
it_behaves_like 'octavia-driver-agent'
if facts[:osfamily] == 'Debian'
it_behaves_like 'octavia-driver-agent on Debian'
let(:platform_params) do
case facts[:osfamily]
when 'Debian'
{ :driver_agent_package_name => 'octavia-driver-agent',
:driver_agent_service_name => 'octavia-driver-agent' }
when 'RedHat'
{ :driver_agent_package_name => 'openstack-octavia-driver-agent',
:driver_agent_service_name => 'octavia-driver-agent' }
end
end
it_behaves_like 'octavia-driver-agent'
end
end