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: I70b9cafad10ec5abfc0166feb01c49adbd1f517d
This commit is contained in:
Tobias Urdin 2019-02-23 22:31:06 +01:00
parent 5d0b6b51c4
commit 6bdeca8d21
3 changed files with 5 additions and 4 deletions

View File

@ -40,7 +40,9 @@ define openstacklib::db::mysql::host_access (
$create_grant = true,
$tls_options = ['NONE'],
) {
validate_re($title, '_', 'Title must be $dbname_$host')
validate_legacy(Pattern[/_/], 'validate_re', $title,
['_', 'Title must be $dbname_$host'])
$host = inline_template('<%= @title.split("_").last.downcase %>')

View File

@ -12,8 +12,7 @@ class openstacklib::policy (
$policies = {},
) {
validate_hash($policies)
validate_legacy(Hash, 'validate_hash', $policies)
create_resources('openstacklib::policy::base', $policies)
}

View File

@ -25,7 +25,7 @@ class openstacklib::policyrcd(
$services
) {
validate_array($services)
validate_legacy(Array, 'validate_array', $services)
if $::osfamily == 'Debian' {
# We put this out there so openstack services wont auto start