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: I503a416e4bd289649532cd29beb7548e420d0e7d
This commit is contained in:
Tobias Urdin 2019-02-23 23:16:35 +01:00
parent 02fe350d78
commit 7ea21f65e4
7 changed files with 8 additions and 9 deletions

View File

@ -171,7 +171,7 @@ class watcher::api (
include ::watcher::keystone::authtoken
}
validate_string($watcher_client_password)
validate_legacy(String, 'validate_string', $watcher_client_password)
package { 'watcher-api':
ensure => $package_ensure,

View File

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

View File

@ -56,8 +56,8 @@ class watcher::db (
include ::watcher::deps
validate_re($database_connection,
'^(sqlite|mysql(\+pymysql)?|postgresql):\/\/(\S+:\S+@\S+\/\S+)?')
validate_legacy(Oslo::Dbconn, 'validate_re', $database_connection,
['^(sqlite|mysql(\+pymysql)?|postgresql):\/\/(\S+:\S+@\S+\/\S+)?'])
oslo::db { 'watcher_config':
connection => $database_connection,

View File

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

View File

@ -68,7 +68,7 @@ class watcher::decision_engine (
include ::watcher::deps
if !is_service_default($weights) {
validate_hash($weights)
validate_legacy(Hash, 'validate_hash', $weights)
$weights_real = join(sort(join_keys_to_values($weights, ':')), ',')
} else {
$weights_real = $weights

View File

@ -226,7 +226,7 @@ class watcher::keystone::authtoken (
fail('Please set password for watcher service user')
}
validate_string($password)
validate_legacy(String, 'validate_string', $password)
if $check_revocations_for_cached {
warning('check_revocations_for_cached parameter is deprecated, has no effect and will be removed in the future.')

View File

@ -31,7 +31,7 @@ class watcher::policy (
include ::watcher::deps
include ::watcher::params
validate_hash($policies)
validate_legacy(Hash, 'validate_hash', $policies)
Openstacklib::Policy::Base {
file_path => $policy_path,
@ -42,5 +42,4 @@ class watcher::policy (
create_resources('openstacklib::policy::base', $policies)
oslo::policy { 'watcher_config': policy_file => $policy_path }
}