Manage octavia-driver-agent package/service
... since octavia-driver-agent is now packaged in Ubuntu and Debian. Change-Id: I07b12acbaba8eb8affc603c2679297495230d37a
This commit is contained in:
parent
f6b4783dc1
commit
84b7c61586
@ -2,6 +2,18 @@
|
|||||||
#
|
#
|
||||||
# == Parameters
|
# == Parameters
|
||||||
#
|
#
|
||||||
|
# [*manage_service*]
|
||||||
|
# (optional) Whether the service should be managed by Puppet.
|
||||||
|
# Defaults to true.
|
||||||
|
#
|
||||||
|
# [*enabled*]
|
||||||
|
# (optional) Should the service be enabled.
|
||||||
|
# Defaults to true
|
||||||
|
#
|
||||||
|
# [*package_ensure*]
|
||||||
|
# (optional) ensure state for package.
|
||||||
|
# Defaults to 'present'
|
||||||
|
#
|
||||||
# [*status_socket_path*]
|
# [*status_socket_path*]
|
||||||
# (optional) Path to the driver status unix domain socket file.
|
# (optional) Path to the driver status unix domain socket file.
|
||||||
# Defaults to $::os_service_default
|
# Defaults to $::os_service_default
|
||||||
@ -57,6 +69,9 @@
|
|||||||
# Defaults to $::os_service_default
|
# Defaults to $::os_service_default
|
||||||
#
|
#
|
||||||
class octavia::driver_agent (
|
class octavia::driver_agent (
|
||||||
|
$manage_service = true,
|
||||||
|
$enabled = true,
|
||||||
|
$package_ensure = 'present',
|
||||||
$status_socket_path = $::os_service_default,
|
$status_socket_path = $::os_service_default,
|
||||||
$stats_socket_path = $::os_service_default,
|
$stats_socket_path = $::os_service_default,
|
||||||
$get_socket_path = $::os_service_default,
|
$get_socket_path = $::os_service_default,
|
||||||
@ -69,11 +84,37 @@ class octavia::driver_agent (
|
|||||||
$max_process_warning_percent = $::os_service_default,
|
$max_process_warning_percent = $::os_service_default,
|
||||||
$provider_agent_shutdown_timeout = $::os_service_default,
|
$provider_agent_shutdown_timeout = $::os_service_default,
|
||||||
$enabled_provider_agents = $::os_service_default,
|
$enabled_provider_agents = $::os_service_default,
|
||||||
) inherits octavia::params {
|
) {
|
||||||
|
|
||||||
include octavia::deps
|
include octavia::deps
|
||||||
|
include octavia::params
|
||||||
|
|
||||||
# Octavia packaging does not currently provide a separate agent service or package.
|
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'],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if $::octavia::params::driver_agent_service_name {
|
||||||
|
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']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
octavia_config {
|
octavia_config {
|
||||||
'driver_agent/status_socket_path': value => $status_socket_path;
|
'driver_agent/status_socket_path': value => $status_socket_path;
|
||||||
|
@ -17,8 +17,10 @@ class octavia::params {
|
|||||||
$worker_package_name = 'openstack-octavia-worker'
|
$worker_package_name = 'openstack-octavia-worker'
|
||||||
$health_manager_package_name = 'openstack-octavia-health-manager'
|
$health_manager_package_name = 'openstack-octavia-health-manager'
|
||||||
$housekeeping_package_name = 'openstack-octavia-housekeeping'
|
$housekeeping_package_name = 'openstack-octavia-housekeeping'
|
||||||
|
$driver_agent_package_name = false
|
||||||
$octavia_wsgi_script_path = '/var/www/cgi-bin/octavia'
|
$octavia_wsgi_script_path = '/var/www/cgi-bin/octavia'
|
||||||
$octavia_wsgi_script_source = '/usr/bin/octavia-wsgi'
|
$octavia_wsgi_script_source = '/usr/bin/octavia-wsgi'
|
||||||
|
$driver_agent_service_name = false
|
||||||
}
|
}
|
||||||
'Debian': {
|
'Debian': {
|
||||||
$common_package_name = 'octavia-common'
|
$common_package_name = 'octavia-common'
|
||||||
@ -26,8 +28,10 @@ class octavia::params {
|
|||||||
$worker_package_name = 'octavia-worker'
|
$worker_package_name = 'octavia-worker'
|
||||||
$health_manager_package_name = 'octavia-health-manager'
|
$health_manager_package_name = 'octavia-health-manager'
|
||||||
$housekeeping_package_name = 'octavia-housekeeping'
|
$housekeeping_package_name = 'octavia-housekeeping'
|
||||||
|
$driver_agent_package_name = 'octavia-driver-agent'
|
||||||
$octavia_wsgi_script_path = '/usr/lib/cgi-bin/octavia'
|
$octavia_wsgi_script_path = '/usr/lib/cgi-bin/octavia'
|
||||||
$octavia_wsgi_script_source = '/usr/bin/octavia-wsgi'
|
$octavia_wsgi_script_source = '/usr/bin/octavia-wsgi'
|
||||||
|
$driver_agent_service_name = 'octavia-driver-agent'
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, \
|
fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, \
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Now the ``octavia::driver_agent`` class can manage the package and
|
||||||
|
the service required to run the octavia-driver-agent service.
|
@ -3,8 +3,7 @@ require 'spec_helper'
|
|||||||
describe 'octavia::driver_agent' do
|
describe 'octavia::driver_agent' do
|
||||||
|
|
||||||
let :params do
|
let :params do
|
||||||
{
|
{}
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
shared_examples_for 'octavia-driver-agent' do
|
shared_examples_for 'octavia-driver-agent' do
|
||||||
@ -57,6 +56,24 @@ describe 'octavia::driver_agent' do
|
|||||||
end
|
end
|
||||||
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({
|
on_supported_os({
|
||||||
:supported_os => OSDefaults.get_supported_os
|
:supported_os => OSDefaults.get_supported_os
|
||||||
@ -65,7 +82,11 @@ describe 'octavia::driver_agent' do
|
|||||||
let (:facts) do
|
let (:facts) do
|
||||||
facts.merge!(OSDefaults.get_facts())
|
facts.merge!(OSDefaults.get_facts())
|
||||||
end
|
end
|
||||||
|
|
||||||
it_behaves_like 'octavia-driver-agent'
|
it_behaves_like 'octavia-driver-agent'
|
||||||
|
if facts[:osfamily] == 'Debian'
|
||||||
|
it_behaves_like 'octavia-driver-agent on Debian'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user