summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJacob Helwig <jacob@puppetlabs.com>2011-02-01 17:07:58 -0800
committerJacob Helwig <jacob@puppetlabs.com>2011-02-01 17:07:58 -0800
commit526335cff0f47c1efc25ffda535e2ead10f10fac (patch)
tree46005b303e7f697b85725d9e9a61735db42287a3 /lib
parentc677f5bd4bb18ec93b82d8f39f317dd40963c2cc (diff)
parentc1b5c7f515a0add663fb532859d91e28ef37a971 (diff)
downloadpuppet-526335cff0f47c1efc25ffda535e2ead10f10fac.tar.gz
puppet-526335cff0f47c1efc25ffda535e2ead10f10fac.tar.xz
puppet-526335cff0f47c1efc25ffda535e2ead10f10fac.zip
Merge branch 'ticket/2.6.x/5913' of git://github.com/mitchellh/puppet into 2.6.next
* 'ticket/2.6.x/5913' of git://github.com/mitchellh/puppet: (#5913) Fix Puppet::Application.find constant lookup behavior
Diffstat (limited to 'lib')
-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)