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: I5d1ebaf9a3b7f6637973ea846d3571c7364feb54
This commit is contained in:
Tobias Urdin 2019-02-23 23:12:52 +01:00
parent 4212800852
commit 880b5e0c1c
5 changed files with 10 additions and 11 deletions

View File

@ -71,16 +71,15 @@ class trove::config (
include ::trove::deps
validate_hash($trove_config)
validate_hash($trove_taskmanager_config)
validate_hash($trove_conductor_config)
validate_hash($trove_guestagent_config)
validate_hash($trove_api_paste_ini)
validate_legacy(Hash, 'validate_hash', $trove_config)
validate_legacy(Hash, 'validate_hash', $trove_taskmanager_config)
validate_legacy(Hash, 'validate_hash', $trove_conductor_config)
validate_legacy(Hash, 'validate_hash', $trove_guestagent_config)
validate_legacy(Hash, 'validate_hash', $trove_api_paste_ini)
create_resources('trove_config', $trove_config)
create_resources('trove_taskmanager_config', $trove_taskmanager_config)
create_resources('trove_conductor_config', $trove_conductor_config)
create_resources('trove_guestagent_config', $trove_guestagent_config)
create_resources('trove_api_paste_ini', $trove_api_paste_ini)
}

View File

@ -60,8 +60,8 @@ class trove::db (
$database_retry_interval_real = pick($::trove::database_retry_interval, $database_retry_interval)
$database_max_overflow_real = pick($::trove::database_max_overflow, $database_max_overflow)
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 { 'trove_config':
connection => $database_connection_real,

View File

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

View File

@ -34,7 +34,7 @@ class trove::db::postgresql(
include ::trove::deps
validate_string($password)
validate_legacy(String, 'validate_string', $password)
::openstacklib::db::postgresql { 'trove':
password_hash => postgresql_password($user, $password),

View File

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