summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/parser')
-rw-r--r--lib/puppet/parser/functions.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/puppet/parser/functions.rb b/lib/puppet/parser/functions.rb
index bc7e870ae..61070627f 100644
--- a/lib/puppet/parser/functions.rb
+++ b/lib/puppet/parser/functions.rb
@@ -97,6 +97,20 @@ module Functions
return true
end
end
+
+ # Test whether a given class or definition is defined
+ newfunction(:defined, :rvalue) do |vals|
+ retval = true
+
+ vals.each do |val|
+ unless builtintype?(val) or lookuptype(val)
+ retval = false
+ break
+ end
+ end
+
+ return retval
+ end
end
end