summaryrefslogtreecommitdiffstats
path: root/lib/puppet/server/report.rb
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-08-28 23:28:37 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-08-28 23:28:37 +0000
commit04b25572bda950d3d088a31d88b4c27d35274fa2 (patch)
tree00f82e13432fbf5c0112d9901128dc556f8d7e8c /lib/puppet/server/report.rb
parent47dbf82cbdf41d4103c6b3b0df6c008f7de76229 (diff)
downloadpuppet-04b25572bda950d3d088a31d88b4c27d35274fa2.tar.gz
puppet-04b25572bda950d3d088a31d88b4c27d35274fa2.tar.xz
puppet-04b25572bda950d3d088a31d88b4c27d35274fa2.zip
Fixing report autoloading; I was calling the wrong method, and they were never getting loaded
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1506 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/server/report.rb')
-rwxr-xr-xlib/puppet/server/report.rb50
1 files changed, 23 insertions, 27 deletions
diff --git a/lib/puppet/server/report.rb b/lib/puppet/server/report.rb
index 8aa4449b2..3d02f5f3d 100755
--- a/lib/puppet/server/report.rb
+++ b/lib/puppet/server/report.rb
@@ -21,6 +21,7 @@ class Server
)
@reports = {}
+ @reportloader = Puppet::Autoload.new(self, "puppet/reports")
class << self
attr_reader :hooks
@@ -45,21 +46,12 @@ class Server
def self.report(name)
name = name.intern if name.is_a? String
unless @reports.include? reportmethod(name)
- begin
- require "puppet/reports/#{name.to_s}"
- unless @reports.include? name
- Puppet.warning(
- "Loaded report file for %s but report was not defined" %
- name
- )
- return nil
- end
- rescue LoadError => detail
- if Puppet[:debug]
- puts detail.backtrace
- end
- Puppet.warning "Could not load report %s: %s" %
- [name, detail]
+ @reportloader.load(name)
+ unless @reports.include? name
+ Puppet.warning(
+ "Loaded report file for %s but report was not defined" %
+ name
+ )
return nil
end
end
@@ -161,19 +153,23 @@ class Server
end
Puppet[:reports].split(/\s*,\s*/).each do |name|
- method = self.class.reportmethod(name)
-
- Puppet.info "Processing report %s" % name
- begin
- send(method, report)
- rescue NoMethodError => detail
- Puppet.warning "No report named '%s'" % name
- rescue => detail
- if Puppet[:debug]
- puts detail.backtrace
+ method = self.class.report(name)
+
+ if respond_to? method
+ Puppet.info "Processing report %s" % name
+ begin
+ send(method, report)
+ rescue NoMethodError => detail
+ Puppet.warning "No report named '%s'" % name
+ rescue => detail
+ if Puppet[:debug]
+ puts detail.backtrace
+ end
+ Puppet.err "Report %s failed: %s" %
+ [name, detail]
end
- Puppet.err "Report %s failed: %s" %
- [name, detail]
+ else
+ Puppet.warning "No report named '%s'" % name
end
end
end