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
This commit is contained in:
Tobias Urdin 2019-02-23 12:39:00 +01:00
parent 496a58a765
commit d8acd8ca2a
16 changed files with 18 additions and 18 deletions

View File

@ -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'

View File

@ -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'

View File

@ -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'

View File

@ -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'

View File

@ -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'

View File

@ -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'

View File

@ -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)

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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