Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Created attachment 1222382[details]
rb error.
Description of problem:
When creating a hook in /usr/share/foreman/config/hooks with name, which does not match correct hook object and event
#foreman-rake hooks:objects
#foreman-rake hooks:events[$object]
webui crashes with
Web application could not be started
uninitialized constant Test (NameError)
Version-Release number of selected component (if applicable):
6.2.4
How reproducible:
100%
Steps to Reproduce:
1. create directory structure with non existing hook in /usr/share/foreman/config/hooks/
for example
/usr/share/foreman/config/hooks/test/test/hook.sh
cat hook.sh
!#/bin/bash
logger "testing hooks"
2. restart apace
#systemctl restart httpd
Actual results:
see attachment. Webui crashes.
Also executing any foreman-rake command fails
foreman-rake katello:reindex
rake aborted!
NameError: uninitialized constant Test
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_hooks-0.3.11/lib/foreman_hooks.rb:90:in `load_missing_constant_with_hooks'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/inflector/methods.rb:238:in `const_get'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/inflector/methods.rb:238:in `block in constantize'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/inflector/methods.rb:236:in `each'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/inflector/methods.rb:236:in `inject'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/inflector/methods.rb:236:in `constantize'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/core_ext/string/inflections.rb:66:in `constantize'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_hooks-0.3.11/lib/foreman_hooks/engine.rb:6:in `block (2 levels) in <class:Engine>'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_hooks-0.3.11/lib/foreman_hooks/engine.rb:6:in `each'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_hooks-0.3.11/lib/foreman_hooks/engine.rb:6:in `block in <class:Engine>'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:438:in `instance_exec'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:438:in `block in make_lambda'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:184:in `call'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:184:in `block in simple'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:185:in `call'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:185:in `block in simple'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:185:in `call'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:185:in `block in simple'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:185:in `call'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:185:in `block in simple'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:185:in `call'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:185:in `block in simple'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:185:in `call'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:185:in `block in simple'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:185:in `call'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:185:in `block in simple'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:86:in `call'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:86:in `run_callbacks'
/opt/rh/rh-ror41/root/usr/share/gems/gems/actionpack-4.1.5/lib/action_dispatch/middleware/reloader.rb:83:in `prepare!'
/opt/rh/rh-ror41/root/usr/share/gems/gems/actionpack-4.1.5/lib/action_dispatch/middleware/reloader.rb:55:in `prepare!'
/opt/rh/rh-ror41/root/usr/share/gems/gems/railties-4.1.5/lib/rails/application/finisher.rb:52:in `block in <module:Finisher>'
/opt/rh/rh-ror41/root/usr/share/gems/gems/railties-4.1.5/lib/rails/initializable.rb:30:in `instance_exec'
/opt/rh/rh-ror41/root/usr/share/gems/gems/railties-4.1.5/lib/rails/initializable.rb:30:in `run'
/opt/rh/rh-ror41/root/usr/share/gems/gems/railties-4.1.5/lib/rails/initializable.rb:55:in `block in run_initializers'
/opt/rh/rh-ror41/root/usr/share/gems/gems/railties-4.1.5/lib/rails/initializable.rb:54:in `run_initializers'
/opt/rh/rh-ror41/root/usr/share/gems/gems/railties-4.1.5/lib/rails/application.rb:300:in `initialize!'
/opt/rh/rh-ror41/root/usr/share/gems/gems/railties-4.1.5/lib/rails/railtie.rb:194:in `public_send'
/opt/rh/rh-ror41/root/usr/share/gems/gems/railties-4.1.5/lib/rails/railtie.rb:194:in `method_missing'
/usr/share/foreman/config/environment.rb:5:in `<top (required)>'
/opt/rh/rh-ror41/root/usr/share/gems/gems/polyglot-0.3.4/lib/polyglot.rb:65:in `require'
/opt/rh/rh-ror41/root/usr/share/gems/gems/railties-4.1.5/lib/rails/application.rb:276:in `require_environment!'
/opt/rh/rh-ror41/root/usr/share/gems/gems/railties-4.1.5/lib/rails/application.rb:379:in `block in run_tasks_blocks'
Tasks: TOP => katello:reindex => environment
Expected results:
Throw warning or error to log, ignore the incorrect hooks.
Additional info:
This was fixed in upstream recently, this will not be part of 6.3. I don't think this is worth backporting, will be fixed in 6.4.
commit fb9dd1d4b3f085dfc896e95dfa2093a4fc318cce
Refs: v0.3.12-3-gfb9dd1d
Author: Dominic Cleal <dominic>
AuthorDate: Wed Oct 19 14:39:58 2016 +0100
Commit: Dominic Cleal <dominic>
CommitDate: Wed Oct 19 14:40:28 2016 +0100
Brad, I would like to schedule this for 6.4 for QA, I don't see Target Version yet. Can you create one? Or what is the correct process? I am setting the flag at least.
Thanks for report.
Stefan, Lukas, thanks for the feedback.
Lukas, we do not currently use Target Version. At this time, we are using the sat-6.4.0 flag for those fixes that we are planning to include in the next release. I will move the bugzilla to POST to reflect that the fix is upstream as well.
Verified on Satellite-6.3 Snap 12.
A hook created as described does not crash the UI and foreman-rake tasks are working as expected.
Comment 9Satellite Program
2018-02-21 16:51:07 UTC
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA.
>
> For information on the advisory, and where to find the updated files, follow the link below.
>
> If the solution does not work for you, open a new bug report.
>
> https://access.redhat.com/errata/RHSA-2018:0336
Created attachment 1222382 [details] rb error. Description of problem: When creating a hook in /usr/share/foreman/config/hooks with name, which does not match correct hook object and event #foreman-rake hooks:objects #foreman-rake hooks:events[$object] webui crashes with Web application could not be started uninitialized constant Test (NameError) Version-Release number of selected component (if applicable): 6.2.4 How reproducible: 100% Steps to Reproduce: 1. create directory structure with non existing hook in /usr/share/foreman/config/hooks/ for example /usr/share/foreman/config/hooks/test/test/hook.sh cat hook.sh !#/bin/bash logger "testing hooks" 2. restart apace #systemctl restart httpd Actual results: see attachment. Webui crashes. Also executing any foreman-rake command fails foreman-rake katello:reindex rake aborted! NameError: uninitialized constant Test /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_hooks-0.3.11/lib/foreman_hooks.rb:90:in `load_missing_constant_with_hooks' /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/inflector/methods.rb:238:in `const_get' /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/inflector/methods.rb:238:in `block in constantize' /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/inflector/methods.rb:236:in `each' /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/inflector/methods.rb:236:in `inject' /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/inflector/methods.rb:236:in `constantize' /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/core_ext/string/inflections.rb:66:in `constantize' /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_hooks-0.3.11/lib/foreman_hooks/engine.rb:6:in `block (2 levels) in <class:Engine>' /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_hooks-0.3.11/lib/foreman_hooks/engine.rb:6:in `each' /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_hooks-0.3.11/lib/foreman_hooks/engine.rb:6:in `block in <class:Engine>' /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:438:in `instance_exec' /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:438:in `block in make_lambda' /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:184:in `call' /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:184:in `block in simple' /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:185:in `call' /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:185:in `block in simple' /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:185:in `call' /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:185:in `block in simple' /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:185:in `call' /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:185:in `block in simple' /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:185:in `call' /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:185:in `block in simple' /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:185:in `call' /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:185:in `block in simple' /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:185:in `call' /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:185:in `block in simple' /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:86:in `call' /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:86:in `run_callbacks' /opt/rh/rh-ror41/root/usr/share/gems/gems/actionpack-4.1.5/lib/action_dispatch/middleware/reloader.rb:83:in `prepare!' /opt/rh/rh-ror41/root/usr/share/gems/gems/actionpack-4.1.5/lib/action_dispatch/middleware/reloader.rb:55:in `prepare!' /opt/rh/rh-ror41/root/usr/share/gems/gems/railties-4.1.5/lib/rails/application/finisher.rb:52:in `block in <module:Finisher>' /opt/rh/rh-ror41/root/usr/share/gems/gems/railties-4.1.5/lib/rails/initializable.rb:30:in `instance_exec' /opt/rh/rh-ror41/root/usr/share/gems/gems/railties-4.1.5/lib/rails/initializable.rb:30:in `run' /opt/rh/rh-ror41/root/usr/share/gems/gems/railties-4.1.5/lib/rails/initializable.rb:55:in `block in run_initializers' /opt/rh/rh-ror41/root/usr/share/gems/gems/railties-4.1.5/lib/rails/initializable.rb:54:in `run_initializers' /opt/rh/rh-ror41/root/usr/share/gems/gems/railties-4.1.5/lib/rails/application.rb:300:in `initialize!' /opt/rh/rh-ror41/root/usr/share/gems/gems/railties-4.1.5/lib/rails/railtie.rb:194:in `public_send' /opt/rh/rh-ror41/root/usr/share/gems/gems/railties-4.1.5/lib/rails/railtie.rb:194:in `method_missing' /usr/share/foreman/config/environment.rb:5:in `<top (required)>' /opt/rh/rh-ror41/root/usr/share/gems/gems/polyglot-0.3.4/lib/polyglot.rb:65:in `require' /opt/rh/rh-ror41/root/usr/share/gems/gems/railties-4.1.5/lib/rails/application.rb:276:in `require_environment!' /opt/rh/rh-ror41/root/usr/share/gems/gems/railties-4.1.5/lib/rails/application.rb:379:in `block in run_tasks_blocks' Tasks: TOP => katello:reindex => environment Expected results: Throw warning or error to log, ignore the incorrect hooks. Additional info: