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: Ie51ec044002f5aae1b4c95c19db3d44a2c16c50f
This commit is contained in:
Tobias Urdin 2019-02-23 23:14:20 +01:00
parent 89ca7a041c
commit bfa686fd9b
4 changed files with 6 additions and 7 deletions

View File

@ -30,8 +30,8 @@ class vitrage::config (
include ::vitrage::deps
validate_hash($vitrage_config)
validate_hash($vitrage_api_paste_ini)
validate_legacy(Hash, 'validate_hash', $vitrage_config)
validate_legacy(Hash, 'validate_hash', $vitrage_api_paste_ini)
create_resources('vitrage_config', $vitrage_config)
create_resources('vitrage_api_paste_ini', $vitrage_api_paste_ini)

View File

@ -56,8 +56,8 @@ class vitrage::db (
include ::vitrage::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 { 'vitrage_config':
connection => $database_connection,

View File

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

View File

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