diff options
| -rw-r--r-- | lib/puppet/application.rb | 9 | ||||
| -rw-r--r-- | lib/puppet/application/inspect.rb | 10 | ||||
| -rwxr-xr-x | spec/unit/application_spec.rb | 4 |
3 files changed, 17 insertions, 6 deletions
diff --git a/lib/puppet/application.rb b/lib/puppet/application.rb index 374dc850b..1e00bcce7 100644 --- a/lib/puppet/application.rb +++ b/lib/puppet/application.rb @@ -215,11 +215,10 @@ class Application def find(name) 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}'." + begin + require File.join('puppet', 'application', name.to_s) + rescue LoadError => e + puts "Unable to find application '#{name}'. #{e}" Kernel::exit(1) end diff --git a/lib/puppet/application/inspect.rb b/lib/puppet/application/inspect.rb index b5a4ac872..6737128aa 100644 --- a/lib/puppet/application/inspect.rb +++ b/lib/puppet/application/inspect.rb @@ -31,7 +31,7 @@ Prepares and submits an inspection report to the puppet master. USAGE ----- -puppet inspect +puppet inspect [--archive_files] [--archive_file_server] DESCRIPTION @@ -57,6 +57,14 @@ configuration file documentation at http://docs.puppetlabs.com/references/latest/configuration.html for the full list of acceptable settings. +* --archive_files: + During an inspect run, whether to archive files whose contents are audited to + a file bucket. + +* --archive_file_server: + During an inspect run, the file bucket server to archive files to if + archive_files is set. The default value is '$server'. + AUTHOR ------ diff --git a/spec/unit/application_spec.rb b/spec/unit/application_spec.rb index aed80e3e6..b56aa20b0 100755 --- a/spec/unit/application_spec.rb +++ b/spec/unit/application_spec.rb @@ -31,6 +31,10 @@ describe Puppet::Application do end it "should exit if it can't find a class" do + reg = "Unable to find application 'ThisShallNeverEverEverExist'. " + reg += "no such file to load -- puppet/application/ThisShallNeverEverEverExist" + @klass.expects(:puts).with(reg) + expect { @klass.find("ThisShallNeverEverEverExist") }.to exit_with 1 end end |
