Bug #1556
closedPuppet rdoc generation is broken in Foreman
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?
Updated by Ohad Levy over 12 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?
Updated by Brian Gupta over 12 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"?
Updated by Ohad Levy over 12 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?
Updated by Lee Lowder over 12 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'.
Updated by Lee Lowder over 12 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.
Updated by Lee Lowder over 12 years ago
I have submitted a pull request to fix one of the problems identified with this ticket.
Updated by Greg Sutcliffe about 11 years ago
- Target version deleted (
Bug scrub)
Updated by Dominic Cleal about 11 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.
Updated by Dominic Cleal over 10 years ago
- Has duplicate Bug #6666: foreman-rake puppet:rdoc:generate doesn't work with puppet 3.6 added
Updated by Jason Antman over 10 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.
Updated by Bougacha Malik over 9 years 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
Updated by Ohad Levy over 9 years ago
- Assignee deleted (
Ohad Levy) - Difficulty deleted (
easy)
Updated by Tomer Brisker about 9 years ago
- Related to Bug #11615: Puppet class index "Environment and Documentaion" links broken added
Updated by Greg Sutcliffe over 8 years ago
- Related to Bug #1189: Example rdoc_prepare_script fails on RHEL 5 added
Updated by Dominic Cleal over 8 years ago
- Related to Bug #14106: Remove puppetclass no_route page added
Updated by Ohad Levy about 8 years ago
- Bugzilla link changed from 1120698 to 1243586
Updated by The Foreman Bot almost 8 years ago
- Status changed from New to Ready For Testing
- Assignee set to Tomer Brisker
- Pull request https://github.com/theforeman/foreman/pull/4058 added
Updated by Anonymous almost 8 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset b1dad4cd18dfc69faa8f1509b0b5b9a361976d59.
Updated by Dominic Cleal almost 8 years ago
- Translation missing: en.field_release set to 189
Updated by The Foreman Bot almost 8 years ago
- Pull request https://github.com/theforeman/foreman/pull/4064 added