summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/puppet/parser/functions/defined_with_params.rb2
-rwxr-xr-xspec/functions/defined_with_params_spec.rb2
2 files changed, 3 insertions, 1 deletions
diff --git a/lib/puppet/parser/functions/defined_with_params.rb b/lib/puppet/parser/functions/defined_with_params.rb
index 7f1fe93..e0d4e37 100644
--- a/lib/puppet/parser/functions/defined_with_params.rb
+++ b/lib/puppet/parser/functions/defined_with_params.rb
@@ -29,7 +29,7 @@ ENDOFDOC
# Workaround for PE-20308
if reference.is_a?(String)
type_name, title = Puppet::Resource.type_and_title(reference, nil)
- type = Puppet::Type.type(type_name)
+ type = Puppet::Pops::Evaluator::Runtime3ResourceSupport.find_resource_type_or_class(find_global_scope, type_name)
elsif reference.is_a?(Puppet::Resource)
type = reference.resource_type
title = reference.title
diff --git a/spec/functions/defined_with_params_spec.rb b/spec/functions/defined_with_params_spec.rb
index 775fa74..491a03b 100755
--- a/spec/functions/defined_with_params_spec.rb
+++ b/spec/functions/defined_with_params_spec.rb
@@ -62,5 +62,7 @@ describe 'defined_with_params' do
end
it { is_expected.to run.with_params('Test::Deftype[foo]', {}).and_return(true) }
it { is_expected.to run.with_params('Test::Deftype[bar]', {}).and_return(false) }
+ it { is_expected.to run.with_params(Puppet::Resource.new('Test::Deftype[foo]'), {}).and_return(true) }
+ it { is_expected.to run.with_params(Puppet::Resource.new('Test::Deftype[bar]'), {}).and_return(false) }
end
end