From e94c1072af7046f9dd867eb924f5fa530ee588e9 Mon Sep 17 00:00:00 2001 From: Tobias Urdin Date: Sun, 10 Feb 2019 13:48:07 +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: Id6ac95b468f7e1f4affed50a2a694216cd72a6c5 --- manifests/profile/params.pp | 3 ++- spec/classes/ceph_profile_params_spec.rb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/manifests/profile/params.pp b/manifests/profile/params.pp index 9b1927a1..1267d141 100644 --- a/manifests/profile/params.pp +++ b/manifests/profile/params.pp @@ -240,7 +240,8 @@ class ceph::profile::params ( $fs_name = undef, $rbd_default_features = undef, ) { - validate_hash($client_keys) + + validate_legacy(Hash, 'validate_hash', $client_keys) if $authentication_type == 'cephx' and empty($client_keys) { fail("client_keys must be provided when using authentication_type = 'cephx'") diff --git a/spec/classes/ceph_profile_params_spec.rb b/spec/classes/ceph_profile_params_spec.rb index 3b36f81c..6eb41512 100644 --- a/spec/classes/ceph_profile_params_spec.rb +++ b/spec/classes/ceph_profile_params_spec.rb @@ -28,7 +28,7 @@ describe 'ceph::profile::params' do }" end - it { should raise_error Puppet::Error, /is not a Hash/ } + it { should raise_error(Puppet::Error) } end describe "should fail when using cephx without client_keys" do