Bug #1556

Puppet rdoc generation is broken in Foreman

Added by Eduardas Jarusevicius almost 5 years ago. Updated 3 months ago.

Status:Closed
Priority:Low
Assigned To:Tomer Brisker
Category:Puppet integration
Target version:Team Daniel - iteration 6
Difficulty: Bugzilla link:1243586
Found in release: Pull request:https://github.com/theforeman/foreman/pull/4064, https://github.com/theforeman/foreman/pull/4058
Story points-
Velocity based estimate-
Release1.14.0Release relationshipAuto

Description

Hello,

I am using following foreman and foreman-proxy versions:

foreman: pre-0.5 (last git commit: dda8e2b951d52a5bfff13317f0b34a9a3c479574)
foreman-proxy: last git commit (aa0a791aa817b0a6a911fa3abe3341a3967dd698)

I tried to generate puppet class documentation according to http://theforeman.org/projects/foreman/wiki/Puppet_class_browser
It fails with the trace output:

** Invoke puppet:rdoc:generate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke puppet:rdoc:prepare (first_time)
** Invoke environment 
** Execute puppet:rdoc:prepare
** Execute puppet:rdoc:generate
rake aborted!
undefined method `id2name' for "testing":String
/opt/foreman/app/models/puppetclass.rb:83:in `rdoc'
/opt/foreman/app/models/puppetclass.rb:79:in `each'
/opt/foreman/app/models/puppetclass.rb:79:in `rdoc'
/opt/foreman/lib/tasks/puppet.rake:17
/opt/foreman/vendor/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/opt/foreman/vendor/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `execute'
/opt/foreman/vendor/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/opt/foreman/vendor/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/opt/foreman/vendor/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/opt/foreman/vendor/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/opt/foreman/vendor/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/opt/foreman/vendor/ruby/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/opt/foreman/vendor/ruby/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
/opt/foreman/vendor/ruby/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/opt/foreman/vendor/ruby/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
/opt/foreman/vendor/ruby/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/opt/foreman/vendor/ruby/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/opt/foreman/vendor/ruby/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `run'
/opt/foreman/vendor/ruby/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/opt/foreman/vendor/ruby/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/opt/foreman/vendor/ruby/1.8/gems/rake-0.9.2.2/bin/rake:33
/opt/foreman/vendor/ruby/1.8/bin/rake:19:in `load'
/opt/foreman/vendor/ruby/1.8/bin/rake:19
Tasks: TOP => puppet:rdoc:generate

I suspected that env is a simple string in puppetclass.rb on line 83, so id2name method doesn't belong there. Tried to remove it - no more complains about it and output path for puppetdoc appears to be correct. Yet generation fails with another problems:

** Invoke puppet:rdoc:generate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke puppet:rdoc:prepare (first_time)
** Invoke environment 
** Execute puppet:rdoc:prepare
** Execute puppet:rdoc:generate
*********Proccessing environment devel *************
puppetdoc --output /opt/foreman/public/puppet/rdoc/devel --modulepath xinetd::paramsxinetd::configxinetdnetwork::paramsnetwork::confignetworksudo::paramssudo::configsudouserssnmp::paramssnmp::configsnmpssh::paramsssh::configsshmunin::node::paramsmunin::node::configmunin::nodemunin::node::paramsmunin::master::configmunin::mastermuninamanda::paramsamanda::configamandantp::paramsntp::configntpbase::snmpbase::amandabase::muninbase::networkbase::sshbase::ntpbase::usersbase::sudobase -m rdoc
puppetdoc --output /opt/foreman/public/puppet/rdoc/devel --modulepath xinetd::paramsxinetd::configxinetdnetwork::paramsnetwork::confignetworksudo::paramssudo::configsudouserssnmp::paramssnmp::configsnmpssh::paramsssh::configsshmunin::node::paramsmunin::node::configmunin::nodemunin::node::paramsmunin::master::configmunin::mastermuninamanda::paramsamanda::configamandantp::paramsntp::configntpbase::snmpbase::amandabase::muninbase::networkbase::sshbase::ntpbase::usersbase::sudobase -m rdoc
RDoc::RDocError is deprecated and will be removed in RDoc 4
Could not generate documentation: uninitialized constant RDoc::RDoc::Generator
Failed to process puppetdocs for /opt/foreman/public/puppet/rdoc/devel while executing puppetdoc --output /opt/foreman/public/puppet/rdoc/devel --modulepath xinetd::paramsxinetd::configxinetdnetwork::paramsnetwork::confignetworksudo::paramssudo::configsudouserssnmp::paramssnmp::configsnmpssh::paramsssh::configsshmunin::node::paramsmunin::node::configmunin::nodemunin::node::paramsmunin::master::configmunin::mastermuninamanda::paramsamanda::configamandantp::paramsntp::configntpbase::snmpbase::amandabase::muninbase::networkbase::sshbase::ntpbase::usersbase::sudobase -m rdoc

Unitialized constant maybe is my environment problem, but are those modulepaths normal?


Related issues

Related to Foreman - Bug #11615: Puppet class index "Environment and Documentaion" links b... Closed 08/30/2015
Related to Foreman - Bug #1189: Example rdoc_prepare_script fails on RHEL 5 Resolved 09/28/2011
Related to Foreman - Bug #14106: Remove puppetclass no_route page Closed 03/08/2016
Duplicates Foreman - Bug #1405: puppet classed rdoc viewer links are broken Duplicate 12/19/2011
Duplicated by Foreman - Bug #6666: foreman-rake puppet:rdoc:generate doesn't work with puppe... Duplicate 07/17/2014

Associated revisions

Revision b04622a4
Added by Lee Lowder over 4 years ago

refs #1556 Removed .id2name from env variable.

Revision a901460a
Added by Lee Lowder over 4 years ago

refs #1556 Removed .id2name from env variable.

Revision b1dad4cd
Added by Tomer Brisker 3 months ago

Fixes #1556, #11615 - Remove puppet rdoc support

Puppet rdoc support has been broken for a long time. Removing it from
Foreman.

Revision d7d14c75
Added by Tomer Brisker 3 months ago

Refs #1556 - Remove puppet docroot setting from db and tests

History

#1 Updated by Ohad Levy almost 5 years ago

  • Status changed from New to Duplicate

#2 Updated by Ohad Levy almost 5 years ago

  • Status changed from Duplicate to New

#3 Updated by Ohad Levy almost 5 years ago

  • Difficulty set to easy

#4 Updated by Ohad Levy over 4 years ago

  • Target version deleted (1.0)

Yes, I can confirm this bug, it seems that when we moved the class importer to the proxy, we broke this feature.

I'm in mixed feelings of how to continue, as for 1.0, we no longer need the manifest checked out on foreman (e.g. master(s) and foreman could be on different servers), but if we generate the docs on the proxy, foreman would need to relay the request (e.g. users might need to access the proxy).

or maybe we could simply offer a script for the users to run on their masters and sync the rdoc content into foreman public/puppet directory?

#5 Updated by Brian Gupta over 4 years ago

To be clear what is now broken? Could we access Puppet docs from within Foreman in the past? If so that sounds like a cool feature we would want to support, I think. Perhaps in addition to importing classes, the puppet proxy could be extended to allow "import docs"?

#6 Updated by Ohad Levy over 4 years ago

Brian Gupta wrote:

To be clear what is now broken? Could we access Puppet docs from within Foreman in the past? If so that sounds like a cool feature we would want to support, I think. Perhaps in addition to importing classes, the puppet proxy could be extended to allow "import docs"?

puppetdoc generates a set of html, describing the puppet classes etc.
at the past, we generated the the html using puppetdoc (reading the manifests from the foreman server) and then put the output in public, so you could view it from foreman directly.

now that the manifest is no longer on the same host, puppetdoc would run on the proxy and then somehow you would need to reach the content.

i think the right way to solve it, is to allow the proxy to generate response (ideally in json) that is equiv to puppetdoc, and then we could always get the latest set of docs?

#7 Updated by Lee Lowder over 4 years ago

Looking at the error output, and based on the errors I see when I call puppet doc directly, this also seems to be a problem with the version of the rdoc gem that is installed.

According to http://projects.puppetlabs.com/issues/11786 puppet doc does not play nicely with rdoc 2.x or 3.x, and the 1.x gems are not available via 'gem install'.

#8 Updated by Lee Lowder over 4 years ago

I did some more testing on this, and installing foreman from git, and using bundler with the --path vendor option allows puppet doc to continue to work on it's own.

If you ALSO adjust <foremandir>/app/models/puppetclass.rb, line 83 to remove the .id2name as per the OP, the rake task will work.

This is because of the puppet bug mentioned in my prior comment.

#9 Updated by Lee Lowder over 4 years ago

I have submitted a pull request to fix one of the problems identified with this ticket.

https://github.com/theforeman/foreman/pull/135

#10 Updated by Greg Sutcliffe over 4 years ago

  • Target version set to Bug scrub

#11 Updated by Greg Sutcliffe over 3 years ago

  • Target version deleted (Bug scrub)

#12 Updated by Dominic Cleal over 3 years ago

  • Description updated (diff)

There aren't any immediate plans to resolve this because we've removed the Puppet dependency from core Foreman for other reasons, which makes it harder to implement. It'll need reimplementing in a different way if it's re-added.

#13 Updated by Dominic Cleal over 2 years ago

  • Duplicated by Bug #6666: foreman-rake puppet:rdoc:generate doesn't work with puppet 3.6 added

#14 Updated by Bryan Kearney over 2 years ago

  • Bugzilla link set to 1120698

#15 Updated by Jason Antman over 2 years ago

Given the current state of `puppet doc` in general (specifically citing https://tickets.puppetlabs.com/browse/PUP-2708) I'd say this isn't a big issue... there was a discussion (on puppet-dev I think, I can't seem to find a pointer to it at the moment) that made it seem like PL knows `puppet doc` is really broken with modern versions of the language, but there's no current plan to fix it.

#16 Updated by Bougacha Malik over 1 year ago

I tried today to run the puppet doc command, which worked quite well on my setup.
I then tried to generate the doc in the correct with:

foreman-rake puppet:rdoc:generate

it crashed with the following stacktrace:


NoMethodError: undefined method `keys' for ["stdlib", stdlib]:Array
/usr/share/foreman/app/models/environment.rb:43:in `block (2 levels) in puppetEnvs'
/usr/share/foreman/app/models/environment.rb:42:in `each'
/usr/share/foreman/app/models/environment.rb:42:in `map'
/usr/share/foreman/app/models/environment.rb:42:in `block in puppetEnvs'
/usr/share/foreman/app/models/environment.rb:41:in `map'
/usr/share/foreman/app/models/environment.rb:41:in `puppetEnvs'
/usr/share/foreman/app/models/puppetclass.rb:129:in `rdoc'
/usr/share/foreman/lib/tasks/puppet.rake:17:in `block (3 levels) in <top (required)>'
Tasks: TOP => puppet:rdoc:generate

#17 Updated by Ohad Levy over 1 year ago

  • Assigned To deleted (Ohad Levy)
  • Difficulty deleted (easy)

#18 Updated by Tomer Brisker over 1 year ago

  • Related to Bug #11615: Puppet class index "Environment and Documentaion" links broken added

#19 Updated by Greg Sutcliffe 12 months ago

  • Related to Bug #1189: Example rdoc_prepare_script fails on RHEL 5 added

#20 Updated by Dominic Cleal 12 months ago

  • Related to Bug #14106: Remove puppetclass no_route page added

#21 Updated by Ohad Levy 5 months ago

  • Bugzilla link changed from 1120698 to 1243586

#22 Updated by The Foreman Bot 3 months ago

  • Status changed from New to Ready For Testing
  • Assigned To set to Tomer Brisker
  • Pull request https://github.com/theforeman/foreman/pull/4058 added

#23 Updated by Anonymous 3 months ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#24 Updated by Dominic Cleal 3 months ago

  • Release set to 1.14.0

#25 Updated by The Foreman Bot 3 months ago

  • Pull request https://github.com/theforeman/foreman/pull/4064 added

#26 Updated by Daniel Lobato Garcia 3 months ago

  • Target version set to Team Daniel - iteration 6

Also available in: Atom PDF