[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. puppet-0.24.5-rc3-1601-gf8c1b08

James Turnbull james at lovedthanlost.net
Fri Jan 15 09:06:58 UTC 2010


The following commit has been merged in the upstream branch:
commit 5f7177efeae81c86086d73b3c7869302cfc6a40d
Author: Brice Figureau <brice-puppet at daysofwonder.com>
Date:   Tue Nov 10 17:57:26 2009 +0100

    Fix #2795 - puppetdoc rdoc reports a better error message
    
    When puppetdoc rdoc dies with an unhandled exception, the error
    message produced didn't mention the file and line where the parser
    choked.
    This patch fixes this by trying to locate on which AST structure
    the rdoc system failed.
    
    Signed-off-by: Brice Figureau <brice-puppet at daysofwonder.com>

diff --git a/lib/puppet/util/rdoc/parser.rb b/lib/puppet/util/rdoc/parser.rb
index 554f8cb..2d219d1 100644
--- a/lib/puppet/util/rdoc/parser.rb
+++ b/lib/puppet/util/rdoc/parser.rb
@@ -180,20 +180,24 @@ class Parser
             scan_for_resource(container,stmt.children) if stmt.is_a?(Puppet::Parser::AST::ASTArray)
 
             if stmt.is_a?(Puppet::Parser::AST::Resource) and !stmt.type.nil?
-                type = stmt.type.split("::").collect { |s| s.capitalize }.join("::")
-                title = stmt.title.is_a?(Puppet::Parser::AST::ASTArray) ? stmt.title.to_s.gsub(/\[(.*)\]/,'\1') : stmt.title.to_s
-                Puppet.debug "rdoc: found resource: %s[%s]" % [type,title]
-
-                param = []
-                stmt.params.children.each do |p|
-                    res = {}
-                    res["name"] = p.param
-                    res["value"] = "#{p.value.to_s}" unless p.value.nil?
-
-                    param << res
+                begin
+                    type = stmt.type.split("::").collect { |s| s.capitalize }.join("::")
+                    title = stmt.title.is_a?(Puppet::Parser::AST::ASTArray) ? stmt.title.to_s.gsub(/\[(.*)\]/,'\1') : stmt.title.to_s
+                    Puppet.debug "rdoc: found resource: %s[%s]" % [type,title]
+
+                    param = []
+                    stmt.params.children.each do |p|
+                        res = {}
+                        res["name"] = p.param
+                        res["value"] = "#{p.value.to_s}" unless p.value.nil?
+
+                        param << res
+                    end
+
+                    container.add_resource(PuppetResource.new(type, title, stmt.doc, param))
+                rescue => detail
+                    raise Puppet::ParseError, "impossible to parse resource in #{stmt.file} at line #{stmt.line}: #{detail}"
                 end
-
-                container.add_resource(PuppetResource.new(type, title, stmt.doc, param))
             end
         end
     end
@@ -225,6 +229,8 @@ class Parser
         end
 
         cls.comment = comment
+    rescue => detail
+        raise Puppet::ParseError, "impossible to parse class '#{name}' in #{klass.file} at line #{klass.line}: #{detail}"
     end
 
     # create documentation for a node
@@ -247,6 +253,8 @@ class Parser
         end
 
         n.comment = comment
+    rescue => detail
+        raise Puppet::ParseError, "impossible to parse node '#{name}' in #{node.file} at line #{node.line}: #{detail}"
     end
 
     # create documentation for a define
@@ -284,6 +292,8 @@ class Parser
         meth.visibility = :public
         meth.document_self = true
         meth.singleton = false
+    rescue => detail
+        raise Puppet::ParseError, "impossible to parse definition '#{name}' in #{define.file} at line #{define.line}: #{detail}"
     end
 
     # Traverse the AST tree and produce code-objects node

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list