diff modules/stdlib/lib/puppet/parser/functions/defined_with_params.rb @ 275:d9352a684e62

Mass update of modules to remove deprecation warnings
author IBBoard <dev@ibboard.co.uk>
date Sun, 26 Jan 2020 11:36:07 +0000
parents c42fb28cff86
children 4a2ee7e3b110
line wrap: on
line diff
--- a/modules/stdlib/lib/puppet/parser/functions/defined_with_params.rb	Sat Jan 04 11:42:45 2020 +0000
+++ b/modules/stdlib/lib/puppet/parser/functions/defined_with_params.rb	Sun Jan 26 11:36:07 2020 +0000
@@ -3,19 +3,25 @@
 
 Puppet::Parser::Functions.newfunction(:defined_with_params,
                                       :type => :rvalue,
-                                      :doc => <<-'DOC'
-    Takes a resource reference and an optional hash of attributes.
+                                      :doc => <<-DOC
+    @summary
+      Takes a resource reference and an optional hash of attributes.
 
-    Returns true if a resource with the specified attributes has already been added
-    to the catalog, and false otherwise.
+    Returns `true` if a resource with the specified attributes has already been added
+    to the catalog, and `false` otherwise.
 
-        user { 'dan':
-          ensure => present,
-        }
+      ```
+      user { 'dan':
+        ensure => present,
+      }
 
-        if ! defined_with_params(User[dan], {'ensure' => 'present' }) {
-          user { 'dan': ensure => present, }
-        }
+      if ! defined_with_params(User[dan], {'ensure' => 'present' }) {
+        user { 'dan': ensure => present, }
+      }
+      ```
+
+    @return [Boolean]
+      returns `true` or `false`
 DOC
                                      ) do |vals|
   reference, params = vals
@@ -31,7 +37,7 @@
       type_name, title = Puppet::Resource.type_and_title(reference, nil)
       type = Puppet::Pops::Evaluator::Runtime3ResourceSupport.find_resource_type_or_class(find_global_scope, type_name.downcase)
     elsif reference.is_a?(Puppet::Resource)
-      type = reference.resource_type
+      type = reference.type
       title = reference.title
     else
       raise(ArgumentError, "Reference is not understood: '#{reference.class}'")