summaryrefslogtreecommitdiffstats
path: root/lib/puppet/application.rb
diff options
context:
space:
mode:
authorMarkus Roberts <Markus@reality.com>2011-02-01 17:57:06 -0800
committerMarkus Roberts <Markus@reality.com>2011-02-01 17:57:06 -0800
commit2a94c61e6c94b1167ea7b858dc184f9f77a7bfc5 (patch)
treee8055300f7d3ac1d3b3a04aed1fab18dbba8789e /lib/puppet/application.rb
parent07edcf716b2f90fb830053b207fe5dc7efcff1f3 (diff)
parented1359902d14a0ca89dac5debee756209b0bd433 (diff)
Merge branch '2.6.next' of git://github.com/puppetlabs/puppet into 2.6.next
Diffstat (limited to 'lib/puppet/application.rb')
-rw-r--r--lib/puppet/application.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/puppet/application.rb b/lib/puppet/application.rb
index f0159a65d..17ad69cee 100644
--- a/lib/puppet/application.rb
+++ b/lib/puppet/application.rb
@@ -212,10 +212,17 @@ class Application
end
def find(name)
- self.const_get(name.to_s.capitalize)
- rescue
+ klass = name.to_s.capitalize
+
+ # const_defined? is used before const_get since const_defined? will only
+ # check within our namespace, whereas const_get will check ancestor
+ # trees as well, resulting in unexpected behaviour.
+ if !self.const_defined?(klass)
puts "Unable to find application '#{name.to_s}'."
Kernel::exit(1)
+ end
+
+ self.const_get(klass)
end
def [](name)