diff options
author | Paul Berry <paul@puppetlabs.com> | 2010-09-21 12:12:19 -0700 |
---|---|---|
committer | Markus Roberts <Markus@reality.com> | 2010-09-22 21:11:31 -0700 |
commit | 99c1019e1d3402ec8e476dc859d5aaef82ec4f69 (patch) | |
tree | 94c261c7b0eb76a213f4f3186031a4a889bb8471 /lib/puppet/util/rdoc/parser.rb | |
parent | 8cd1540f82cbdf903c164bdbc2c7229e34a4178b (diff) | |
download | puppet-99c1019e1d3402ec8e476dc859d5aaef82ec4f69.tar.gz puppet-99c1019e1d3402ec8e476dc859d5aaef82ec4f69.tar.xz puppet-99c1019e1d3402ec8e476dc859d5aaef82ec4f69.zip |
[#4798] Puppet doc manifests documentation mode broken
When running puppet doc, if the directory containing the user's
specified manifest file overlaps with the modules directory (i.e. they
are the same directory or one contains the other), Puppet doc would
try to parse the overlapping files twice, triggering an exception
which made the documentation run fail.
Fixed the bug by adding a check to the RDoc::Parser#scan method to
prevent re-parsing of files that have already been parsed. Also added
a spec test to verify that this works.
Diffstat (limited to 'lib/puppet/util/rdoc/parser.rb')
-rw-r--r-- | lib/puppet/util/rdoc/parser.rb | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/puppet/util/rdoc/parser.rb b/lib/puppet/util/rdoc/parser.rb index 63df38ab9..841484322 100644 --- a/lib/puppet/util/rdoc/parser.rb +++ b/lib/puppet/util/rdoc/parser.rb @@ -33,13 +33,16 @@ class Parser # main entry point def scan - Puppet.info "rdoc: scanning #{@input_file_name}" - if @input_file_name =~ /\.pp$/ - @parser = Puppet::Parser::Parser.new(Puppet[:environment]) - @parser.file = @input_file_name - @ast = @parser.parse + env = Puppet::Node::Environment.new + unless env.known_resource_types.watching_file?(@input_file_name) + Puppet.info "rdoc: scanning #{@input_file_name}" + if @input_file_name =~ /\.pp$/ + @parser = Puppet::Parser::Parser.new(env) + @parser.file = @input_file_name + @ast = @parser.parse + end + scan_top_level(@top_level) end - scan_top_level(@top_level) @top_level end |