Issue #4911 has been updated by Brice Figureau.

Markus Roberts wrote:
> The problem appears to be puppet doc attempting to parse files in the 
> module's files directories for documentation strings.  As these aren't even 
> require to be ASCII, the results are...not useful.  It also turns out not to 
> be a regression, but rather a corner case that has never been dealt with well.


Puppet doc instructs rdoc that it knows to parse rb and pp files only. That 
means it won't ever try to parse random files.
When rdoc find files to parse it matches a given regex against the filename and 
call the correct parser. The current puppet doc parser asks for pp and rb (for 
plugins), and should skip them if they are not in their proper module standard 
directories. 
What seems to happen here is that rdoc has a default parser for rb files that 
certainly is triggered when it finds rb files in the files module subdirectory. 
This parser populates the same data structure than the puppet rdoc parser, but 
is incompatible with the puppet HTML renderer.
One solution would be to let the puppet rdoc parser to say to rdoc that it can 
parse any rb and then do nothing. Another solution might be to remove the 
default rb parser from rdoc when puppet rdoc is launched.
Or if it happens to be an issue in puppet doc itself, we should make sure we 
don't parse those rb files.


> 
> Oddly, puppet doc does not seem to think it is reading these files (they 
> don't show up in the log, and diagnostic code does not show them being read) 
> but 1) they wind up in the data structure used to generate the docs and 2) 
> removing them from the modules eliminates the problem.

That matches my feeling that it's the regular ruby rdoc parser that is 
triggered.
I'll take a stab at fixing this when I'll be back from puppet camp if needed.

----------------------------------------
Bug #4911: puppet doc fails with: undefined method `global'
http://projects.puppetlabs.com/issues/4911

Author: R.I. Pienaar aka Volcane
Status: Accepted
Priority: Normal
Assignee: Markus Roberts
Category: 
Target version: queued
Affected version: 0.25.0
Keywords: 
Branch: 


With an empty site.pp and a bunch of modules in the location I get:

<pre>
$ git checkout 2.6.2rc1; cd puppet
HEAD is now at 917c520... Incremented version to 2.6.2
$ RUBYLIB=lib bin/puppet doc --mode rdoc 
--modulepath=/home/rip/manifests/modules 
--manifest=/home/rip/manifests/modules/site.pp --trace --debug
/usr/lib/ruby/1.8/rdoc/dot/dot.rb:28: warning: already initialized constant 
NODE_OPTS
/usr/lib/ruby/1.8/rdoc/dot/dot.rb:46: warning: already initialized constant 
EDGE_OPTS
/usr/lib/ruby/1.8/rdoc/dot/dot.rb:76: warning: already initialized constant 
GRAPH_OPTS
<snip>
info: rdoc: scanning /home/rip/manifests/modules/greylistd/manifests/install.pp
debug: rdoc: testing /home/rip/manifests/modules/greylistd/manifests/install.pp
debug: rdoc: module greylistd into /home/rip/manifests/modules ?
debug: rdoc: found module greylistd
debug: rdoc: scanning for greylistd
debug: rdoc: scanning manifest
debug: rdoc: found new class greylistd::install
debug: found realize: Package["greylistd"]
./lib/puppet/util/rdoc/generators/puppet_generator.rb:300:in `main_url'
./lib/puppet/util/rdoc/generators/puppet_generator.rb:299:in `each'
./lib/puppet/util/rdoc/generators/puppet_generator.rb:299:in `main_url'
./lib/puppet/util/rdoc/generators/puppet_generator.rb:199:in `gen_top_index'
./lib/puppet/util/rdoc/generators/puppet_generator.rb:183:in `gen_file_index'
/usr/lib/ruby/1.8/rdoc/generators/html_generator.rb:1279:in `generate_html'
./lib/puppet/util/rdoc/generators/puppet_generator.rb:70:in `generate_html'
/usr/lib/ruby/1.8/rdoc/generators/html_generator.rb:1197:in `generate'
/usr/lib/ruby/1.8/rdoc/rdoc.rb:284:in `document'
./lib/puppet/util/rdoc.rb:35:in `rdoc'
./lib/puppet/application/doc.rb:85:in `rdoc'
./lib/puppet/application/doc.rb:59:in `send'
./lib/puppet/application/doc.rb:59:in `run_command'
./lib/puppet/application.rb:300:in `run'
./lib/puppet/application.rb:397:in `exit_on_fail'
./lib/puppet/application.rb:300:in `run'
./lib/puppet/util/command_line.rb:55:in `execute'
bin/puppet:4
Could not generate documentation: undefined method `global' for 
#&lt;RDoc::TopLevel:0x2b7e453e2f58>
</pre>

This took a long time to get to this point and did create a load of html in the 
doc directory  though it didn't finish as there's no overall index for example 
- lots of modules have been documented though.

If I run it with --debug I see it's scanning a lot of my .rb files that are in 
files of modules, if I rm all of those .rb files same error so that's probably 
a redherring.



-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to