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
This commit is contained in:
Tobias Urdin 2019-02-23 22:25:00 +01:00
parent a2aa65341e
commit 9825c437e5
6 changed files with 7 additions and 8 deletions

View File

@ -26,7 +26,7 @@ class octavia::config (
include ::octavia::deps
validate_hash($octavia_config)
validate_legacy(Hash, 'validate_hash', $octavia_config)
create_resources('octavia_config', $octavia_config)
}

View File

@ -66,9 +66,8 @@ class octavia::db (
$database_pool_timeout_real = pick($::octavia::database_pool_timeout, $database_pool_timeout)
$database_db_max_retries_real = pick($::octavia::database_db_max_retries, $database_db_max_retries)
validate_re($database_connection_real,
'^(sqlite|mysql(\+pymysql)?|postgresql):\/\/(\S+:\S+@\S+\/\S+)?')
validate_legacy(Oslo::Dbconn, 'validate_re', $database_connection_real,
['^(sqlite|mysql(\+pymysql)?|postgresql):\/\/(\S+:\S+@\S+\/\S+)?'])
oslo::db { 'octavia_config':
connection => $database_connection_real,

View File

@ -45,7 +45,7 @@ class octavia::db::mysql(
include ::octavia::deps
validate_string($password)
validate_legacy(String, 'validate_string', $password)
::openstacklib::db::mysql { 'octavia':
user => $user,

View File

@ -46,7 +46,7 @@ class octavia::health_manager (
include ::octavia::deps
validate_string($heartbeat_key)
validate_legacy(String, 'validate_string', $heartbeat_key)
package { 'octavia-health-manager':
ensure => $package_ensure,

View File

@ -31,7 +31,7 @@ class octavia::policy (
include ::octavia::deps
include ::octavia::params
validate_hash($policies)
validate_legacy(Hash, 'validate_hash', $policies)
Openstacklib::Policy::Base {
file_path => $policy_path,

View File

@ -148,7 +148,7 @@ class octavia::worker (
set octavia::controller class before octavia::worker!')
}
validate_hash($nova_flavor_config)
validate_legacy(Hash, 'validate_hash', $nova_flavor_config)
if ! $::octavia::controller::amp_flavor_id_real {
if $manage_nova_flavor {