From 12dc2654e8425c5c6427b276d84996d61a1e7769 Mon Sep 17 00:00:00 2001 From: Tobias Urdin Date: Sat, 23 Feb 2019 12:10:54 +0100 Subject: [PATCH] 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: I511f23ac6af3b46bb6f0afc68b41fa1715ba9146 --- manifests/config.pp | 2 +- manifests/db.pp | 4 ++-- manifests/db/mysql.pp | 2 +- manifests/policy.pp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/manifests/config.pp b/manifests/config.pp index 09ce564b..fc596e21 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -26,7 +26,7 @@ class gnocchi::config ( include ::gnocchi::deps - validate_hash($gnocchi_config) + validate_legacy(Hash, 'validate_hash', $gnocchi_config) create_resources('gnocchi_config', $gnocchi_config) } diff --git a/manifests/db.pp b/manifests/db.pp index db332b02..e735e30f 100644 --- a/manifests/db.pp +++ b/manifests/db.pp @@ -23,8 +23,8 @@ class gnocchi::db ( # to use gnocchi:: if gnocchi::db:: isn't specified. $database_connection_real = pick($::gnocchi::database_connection, $database_connection) - 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+)?']) if $database_connection_real { case $database_connection_real { diff --git a/manifests/db/mysql.pp b/manifests/db/mysql.pp index 35ff364f..8a4c7258 100644 --- a/manifests/db/mysql.pp +++ b/manifests/db/mysql.pp @@ -45,7 +45,7 @@ class gnocchi::db::mysql( include ::gnocchi::deps - validate_string($password) + validate_legacy(String, 'validate_string', $password) ::openstacklib::db::mysql { 'gnocchi': user => $user, diff --git a/manifests/policy.pp b/manifests/policy.pp index ebc2f87c..d79204aa 100644 --- a/manifests/policy.pp +++ b/manifests/policy.pp @@ -31,7 +31,7 @@ class gnocchi::policy ( include ::gnocchi::deps include ::gnocchi::params - validate_hash($policies) + validate_legacy(Hash, 'validate_hash', $policies) Openstacklib::Policy::Base { file_path => $policy_path,