puppet-octavia/manifests/health_manager.pp
Tobias Urdin 9825c437e5 Use validate_legacy
This changes all the puppet 3 validate_* functions
to use the validate_legacy function.

The validate_legacy function has been available since
about three years but require Puppet >= 4.4.0 and since
there is Puppet 4.10.12 as latest we should assume people
are running a fairly new Puppet 4 version.

This is the first step to then remove all validate function
calls and use proper types for parameter as described in spec [1].

[1] https://review.openstack.org/#/c/568929/

Change-Id: I12c38f4e42684b65d55d1d94ca6d6fb4042a6a8b
2019-02-23 22:25:00 +01:00

83 lines
2.3 KiB
Puppet

# Installs and configures the octavia health manager service
#
# == Parameters
#
# [*heartbeat_key*]
# Key to validate amphora messages.
#
# [*enabled*]
# (optional) Should the service be enabled.
# Defaults to true
#
# [*manage_service*]
# (optional) Whether the service should be managed by Puppet.
# Defaults to true.
#
# [*package_ensure*]
# (optional) ensure state for package.
# Defaults to 'present'
#
# [*event_streamer_driver*]
# (optional) Driver to use for synchronizing octavia and lbaas databases.
# Defaults to $::os_service_default
#
# [*ip*]
# (optional) The bind ip for the health manager
# Defaults to $::os_service_default
#
# [*workers*]
# (optional) The number of workers health_manager spawns
# Defaults to $::os_workers
#
# [*port*]
# (optional) The bind port for the health manager
# Defaults to $::os_service_default
#
class octavia::health_manager (
$heartbeat_key,
$manage_service = true,
$enabled = true,
$package_ensure = 'present',
$event_streamer_driver = $::os_service_default,
$ip = $::os_service_default,
$port = $::os_service_default,
$workers = $::os_workers,
) inherits octavia::params {
include ::octavia::deps
validate_legacy(String, 'validate_string', $heartbeat_key)
package { 'octavia-health-manager':
ensure => $package_ensure,
name => $::octavia::params::health_manager_package_name,
tag => ['openstack', 'octavia-package'],
}
if $manage_service {
if $enabled {
$service_ensure = 'running'
} else {
$service_ensure = 'stopped'
}
}
service { 'octavia-health-manager':
ensure => $service_ensure,
name => $::octavia::params::health_manager_service_name,
enable => $enabled,
hasstatus => true,
hasrestart => true,
tag => ['octavia-service'],
}
octavia_config {
'health_manager/heartbeat_key' : value => $heartbeat_key;
'health_manager/event_streamer_driver' : value => $event_streamer_driver;
'health_manager/bind_ip' : value => $ip;
'health_manager/bind_port' : value => $port;
'health_manager/health_update_threads' : value => $workers;
'health_manager/stats_update_threads' : value => $workers;
}
}