From d8acd8ca2a76e8c7db8b45f41a25c88328eb1f05 Mon Sep 17 00:00:00 2001 From: Tobias Urdin Date: Sat, 23 Feb 2019 12:39:00 +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: Iaa929ff3f95e930af23a32a14ee81bb4971af3a5 --- manifests/backend/dellemc_isilon.pp | 2 +- manifests/backend/dellemc_unity.pp | 2 +- manifests/backend/dellemc_vmax.pp | 2 +- manifests/backend/dellemc_vnx.pp | 2 +- manifests/backend/hitachi_hnas.pp | 2 +- manifests/backend/netapp.pp | 2 +- manifests/config.pp | 4 ++-- manifests/db.pp | 4 ++-- manifests/db/mysql.pp | 2 +- manifests/policy.pp | 2 +- spec/defines/manila_backend_dellemc_isilon_spec.rb | 2 +- spec/defines/manila_backend_dellemc_unity_spec.rb | 2 +- spec/defines/manila_backend_dellemc_vmax_spec.rb | 2 +- spec/defines/manila_backend_dellemc_vnx_spec.rb | 2 +- spec/defines/manila_backend_hitachi_hnas_spec.rb | 2 +- spec/defines/manila_backend_netapp_spec.rb | 2 +- 16 files changed, 18 insertions(+), 18 deletions(-) diff --git a/manifests/backend/dellemc_isilon.pp b/manifests/backend/dellemc_isilon.pp index bc0a1215..c8048220 100644 --- a/manifests/backend/dellemc_isilon.pp +++ b/manifests/backend/dellemc_isilon.pp @@ -69,7 +69,7 @@ define manila::backend::dellemc_isilon ( include ::manila::deps - validate_string($emc_nas_password) + validate_legacy(String, 'validate_string', $emc_nas_password) $dellemc_isilon_share_driver = 'manila.share.drivers.emc.driver.EMCShareDriver' diff --git a/manifests/backend/dellemc_unity.pp b/manifests/backend/dellemc_unity.pp index 7af8b96d..ba39c559 100644 --- a/manifests/backend/dellemc_unity.pp +++ b/manifests/backend/dellemc_unity.pp @@ -94,7 +94,7 @@ define manila::backend::dellemc_unity ( include ::manila::deps - validate_string($emc_nas_password) + validate_legacy(String, 'validate_string', $emc_nas_password) $unity_share_driver = 'manila.share.drivers.emc.driver.EMCShareDriver' diff --git a/manifests/backend/dellemc_vmax.pp b/manifests/backend/dellemc_vmax.pp index 5b0da095..b2a48495 100644 --- a/manifests/backend/dellemc_vmax.pp +++ b/manifests/backend/dellemc_vmax.pp @@ -73,7 +73,7 @@ define manila::backend::dellemc_vmax ( include ::manila::deps - validate_string($emc_nas_password) + validate_legacy(String, 'validate_string', $emc_nas_password) $vmax_share_driver = 'manila.share.drivers.emc.driver.EMCShareDriver' diff --git a/manifests/backend/dellemc_vnx.pp b/manifests/backend/dellemc_vnx.pp index ed9824c8..22958ad4 100644 --- a/manifests/backend/dellemc_vnx.pp +++ b/manifests/backend/dellemc_vnx.pp @@ -93,7 +93,7 @@ define manila::backend::dellemc_vnx ( include ::manila::deps - validate_string($emc_nas_password) + validate_legacy(String, 'validate_string', $emc_nas_password) $vnx_share_driver = 'manila.share.drivers.emc.driver.EMCShareDriver' diff --git a/manifests/backend/hitachi_hnas.pp b/manifests/backend/hitachi_hnas.pp index 092d0ce3..9635f154 100644 --- a/manifests/backend/hitachi_hnas.pp +++ b/manifests/backend/hitachi_hnas.pp @@ -63,7 +63,7 @@ define manila::backend::hitachi_hnas ( include ::manila::deps - validate_string($hitachi_hnas_password) + validate_legacy(String, 'validate_string', $hitachi_hnas_password) $hitachi_share_driver = 'manila.share.drivers.hitachi.hds_hnas.HDSHNASDriver' diff --git a/manifests/backend/netapp.pp b/manifests/backend/netapp.pp index d87ac86c..fc44d429 100644 --- a/manifests/backend/netapp.pp +++ b/manifests/backend/netapp.pp @@ -122,7 +122,7 @@ define manila::backend::netapp ( include ::manila::deps - validate_string($netapp_password) + validate_legacy(String, 'validate_string', $netapp_password) $netapp_share_driver = 'manila.share.drivers.netapp.common.NetAppDriver' diff --git a/manifests/config.pp b/manifests/config.pp index 5af4784c..0d936d07 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -34,8 +34,8 @@ class manila::config ( include ::manila::deps - validate_hash($manila_config) - validate_hash($api_paste_ini_config) + validate_legacy(Hash, 'validate_hash', $manila_config) + validate_legacy(Hash, 'validate_hash', $api_paste_ini_config) create_resources('manila_config', $manila_config) create_resources('manila_api_paste_ini', $api_paste_ini_config) diff --git a/manifests/db.pp b/manifests/db.pp index 00536f10..d854a409 100644 --- a/manifests/db.pp +++ b/manifests/db.pp @@ -66,8 +66,8 @@ class manila::db ( $database_retry_interval_real = pick($::manila::database_retry_interval, $database_retry_interval) $database_max_overflow_real = pick($::manila::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 { 'manila_config': connection => $database_connection_real, diff --git a/manifests/db/mysql.pp b/manifests/db/mysql.pp index e0cea62c..9ad80b00 100644 --- a/manifests/db/mysql.pp +++ b/manifests/db/mysql.pp @@ -47,7 +47,7 @@ class manila::db::mysql ( include ::manila::deps - validate_string($password) + validate_legacy(String, 'validate_string', $password) ::openstacklib::db::mysql { 'manila': user => $user, diff --git a/manifests/policy.pp b/manifests/policy.pp index 8b5a87bd..7c581d09 100644 --- a/manifests/policy.pp +++ b/manifests/policy.pp @@ -31,7 +31,7 @@ class manila::policy ( include ::manila::deps include ::manila::params - validate_hash($policies) + validate_legacy(Hash, 'validate_hash', $policies) Openstacklib::Policy::Base { file_path => $policy_path, diff --git a/spec/defines/manila_backend_dellemc_isilon_spec.rb b/spec/defines/manila_backend_dellemc_isilon_spec.rb index 1a56cd74..fad0999c 100644 --- a/spec/defines/manila_backend_dellemc_isilon_spec.rb +++ b/spec/defines/manila_backend_dellemc_isilon_spec.rb @@ -60,7 +60,7 @@ describe 'manila::backend::dellemc_isilon' do }) end - it { is_expected.to raise_error(Puppet::Error, /true is not a string. It looks to be a TrueClass/) } + it { is_expected.to raise_error(Puppet::Error) } end end diff --git a/spec/defines/manila_backend_dellemc_unity_spec.rb b/spec/defines/manila_backend_dellemc_unity_spec.rb index 83e7f22c..fc157c40 100644 --- a/spec/defines/manila_backend_dellemc_unity_spec.rb +++ b/spec/defines/manila_backend_dellemc_unity_spec.rb @@ -69,7 +69,7 @@ describe 'manila::backend::dellemc_unity' do }) end - it { is_expected.to raise_error(Puppet::Error, /true is not a string. It looks to be a TrueClass/) } + it { is_expected.to raise_error(Puppet::Error) } end end diff --git a/spec/defines/manila_backend_dellemc_vmax_spec.rb b/spec/defines/manila_backend_dellemc_vmax_spec.rb index 6d623a21..63f957bd 100644 --- a/spec/defines/manila_backend_dellemc_vmax_spec.rb +++ b/spec/defines/manila_backend_dellemc_vmax_spec.rb @@ -63,7 +63,7 @@ describe 'manila::backend::dellemc_vmax' do }) end - it { is_expected.to raise_error(Puppet::Error, /true is not a string. It looks to be a TrueClass/) } + it { is_expected.to raise_error(Puppet::Error) } end end diff --git a/spec/defines/manila_backend_dellemc_vnx_spec.rb b/spec/defines/manila_backend_dellemc_vnx_spec.rb index 80e3cd59..718df863 100644 --- a/spec/defines/manila_backend_dellemc_vnx_spec.rb +++ b/spec/defines/manila_backend_dellemc_vnx_spec.rb @@ -69,7 +69,7 @@ describe 'manila::backend::dellemc_vnx' do }) end - it { is_expected.to raise_error(Puppet::Error, /true is not a string. It looks to be a TrueClass/) } + it { is_expected.to raise_error(Puppet::Error) } end end diff --git a/spec/defines/manila_backend_hitachi_hnas_spec.rb b/spec/defines/manila_backend_hitachi_hnas_spec.rb index 098de135..f468ec5f 100644 --- a/spec/defines/manila_backend_hitachi_hnas_spec.rb +++ b/spec/defines/manila_backend_hitachi_hnas_spec.rb @@ -42,7 +42,7 @@ describe 'manila::backend::hitachi_hnas' do }) end - it { is_expected.to raise_error(Puppet::Error, /true is not a string. It looks to be a TrueClass/) } + it { is_expected.to raise_error(Puppet::Error) } end end diff --git a/spec/defines/manila_backend_netapp_spec.rb b/spec/defines/manila_backend_netapp_spec.rb index 0fdc915d..400cd0ff 100644 --- a/spec/defines/manila_backend_netapp_spec.rb +++ b/spec/defines/manila_backend_netapp_spec.rb @@ -68,7 +68,7 @@ describe 'manila::backend::netapp' do }) end - it { is_expected.to raise_error(Puppet::Error, /true is not a string. It looks to be a TrueClass/) } + it { is_expected.to raise_error(Puppet::Error) } end end