summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/functions
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/parser/functions')
-rw-r--r--lib/puppet/parser/functions/defined.rb6
-rw-r--r--lib/puppet/parser/functions/require.rb2
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/puppet/parser/functions/defined.rb b/lib/puppet/parser/functions/defined.rb
index 5ad74a79e..4d1d8c6fd 100644
--- a/lib/puppet/parser/functions/defined.rb
+++ b/lib/puppet/parser/functions/defined.rb
@@ -6,21 +6,21 @@ Puppet::Parser::Functions::newfunction(:defined, :type => :rvalue, :doc => "Dete
(e.g., ``if defined(File['/tmp/myfile']) { ... }``). This function is unfortunately
dependent on the parse order of the configuration when testing whether a resource is defined.") do |vals|
result = false
+ vals = [vals] unless vals.is_a?(Array)
vals.each do |val|
case val
when String
- # For some reason, it doesn't want me to return from here.
if Puppet::Type.type(val) or find_definition(val) or find_hostclass(val)
result = true
break
end
- when Puppet::Parser::Resource::Reference
+ when Puppet::Resource
if findresource(val.to_s)
result = true
break
end
else
- raise ArgumentError, "Invalid argument of type %s to 'defined'" % val.class
+ raise ArgumentError, "Invalid argument of type '#{val.class}' to 'defined'"
end
end
result
diff --git a/lib/puppet/parser/functions/require.rb b/lib/puppet/parser/functions/require.rb
index 66d60b9ce..294484a2b 100644
--- a/lib/puppet/parser/functions/require.rb
+++ b/lib/puppet/parser/functions/require.rb
@@ -49,7 +49,7 @@ fail if used with earlier clients.
# The 'obvious' way is just to add an edge in the catalog,
# but that is considered a containment edge, not a dependency
# edge, so it usually gets lost on the client.
- ref = Puppet::Parser::Resource::Reference.new(:type => :class, :title => klass)
+ ref = Puppet::Resource.new(:class, klass)
resource.set_parameter(:require, [resource[:require]].flatten.compact << ref)
end
end