From 068b61e022c42fb12a5c657cb9d1ebbd98c7ca38 Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Wed, 13 Feb 2008 08:56:06 -0600 Subject: [PATCH] Removing obsolete references (they're in the indirection reference), and adding error handling to puppetdoc. --- bin/puppetdoc | 16 +++++++++++++--- lib/puppet/reference/node_source.rb | 9 --------- lib/puppet/reference/report.rb | 21 --------------------- 3 files changed, 13 insertions(+), 33 deletions(-) delete mode 100644 lib/puppet/reference/node_source.rb delete mode 100644 lib/puppet/reference/report.rb diff --git a/bin/puppetdoc b/bin/puppetdoc index be86cc618..82e4c076b 100755 --- a/bin/puppetdoc +++ b/bin/puppetdoc @@ -128,11 +128,19 @@ else else with_contents = true end + exit_code = 0 options[:references].sort { |a,b| a.to_s <=> b.to_s }.each do |name| - section = Puppet::Util::Reference.reference(name) + raise "Could not find reference %s" % name unless section = Puppet::Util::Reference.reference(name) - # Add the per-section text, but with no ToC - text += section.send(options[:format], with_contents) + begin + # Add the per-section text, but with no ToC + text += section.send(options[:format], with_contents) + rescue => detail + puts detail.backtrace + $stderr.puts "Could not generate reference %s: %s" % [name, detail] + exit_code = 1 + next + end end unless with_contents # We've only got one reference @@ -147,6 +155,8 @@ else else puts text end + + exit exit_code end diff --git a/lib/puppet/reference/node_source.rb b/lib/puppet/reference/node_source.rb deleted file mode 100644 index 29a01f850..000000000 --- a/lib/puppet/reference/node_source.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'puppet/node' - -noderef = Puppet::Util::Reference.newreference :node_source, :doc => "Sources of node configuration information" do - Puppet::Network::Handler.node.docs -end - -noderef.header = " -Nodes can be searched for in different locations. This document describes those different locations. -" diff --git a/lib/puppet/reference/report.rb b/lib/puppet/reference/report.rb deleted file mode 100644 index a8086f8bc..000000000 --- a/lib/puppet/reference/report.rb +++ /dev/null @@ -1,21 +0,0 @@ -report = Puppet::Util::Reference.newreference :report, :doc => "All available transaction reports" do - Puppet::Network::Handler.report.reportdocs -end - -report.header = " -Puppet clients can report back to the server after each transaction. This -transaction report is sent as a YAML dump of the -``Puppet::Transaction::Report`` class and includes every log message that was -generated during the transaction along with as many metrics as Puppet knows how -to collect. See `ReportsAndReporting Reports and Reporting`:trac: -for more information on how to use reports. - -Currently, clients default to not sending in reports; you can enable reporting -by setting the ``report`` parameter to true. - -To use a report, set the ``reports`` parameter on the server; multiple -reports must be comma-separated. You can also specify ``none`` to disable -reports entirely. - -Puppet provides multiple report handlers that will process client reports: -"