Bug #8009
closedPlugin Salt interferes with Bootdisk in Host view
Description
- Foreman 1.6.2
- BootDisk plugin 3.2.0
- Salt plugin 0.0.4
- Ubuntu Trusty, everything up-to-date & from repos
When opening the host status page (https://foreman.example.com/hosts/host1.example.com), it buggers out reporting
NoMethodError undefined method `display_bootdisk_link_if_authorized' for #<#<Class:0x00000009ed08d8>:0x0000000a90a830> app/views/hosts/show.html.erb:4:in `_b2a322d60e2e8852e412ab7bf4d42ce1' app/models/concerns/foreman/thread_session.rb:33:in `clear_thread' lib/middleware/catch_json_parse_errors.rb:9:in `call'
With the production log saying:
Operation FAILED: undefined method `display_bootdisk_link_if_authorized' for #<#<Class:0x00000009ed08d8>:0x0000000afdd220> /usr/share/foreman/vendor/ruby/1.9.1/gems/foreman_bootdisk-3.2.0/app/helpers/concerns/foreman_bootdisk/hosts_helper_ext.rb:12:in `host_title_actions_with_bootdisk' /usr/share/foreman/app/views/hosts/show.html.erb:4:in `_b2a322d60e2e8852e412ab7bf4d42ce1' /usr/share/foreman/vendor/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_view/template.rb:145:in `block in render' /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/notifications.rb:125:in `instrument' /usr/share/foreman/vendor/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_view/template.rb:143:in `render' /usr/share/foreman/vendor/ruby/1.9.1/gems/deface-0.9.1/lib/deface/action_view_extensions.rb:37:in `render' /usr/share/foreman/vendor/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_view/renderer/template_renderer.rb:47:in `block (2 levels) in render_template' /usr/share/foreman/vendor/ruby/1.9.1/gems/actionpack-3.2.18/lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument' ETC
This method is both called & defined from https://github.com/theforeman/foreman_bootdisk/blob/master/app/helpers/concerns/foreman_bootdisk/hosts_helper_ext.rb
Removing the Salt plugin resolves the problem, reinstalling it reintroduces it.
Apparently the Salt plugin attempts to do something to the hosts view which breaks the concern?
Updated by Ivan Necas about 10 years ago
- Project changed from Salt to Foreman
- Category set to Plugin integration
- Status changed from New to Assigned
- Assignee set to Ivan Necas
- Target version set to 1.7.2
The root cause of the issue is the ordering in which the plugins happend to extend helpers and controllers. In this particular case:
1. Salt extends the HostsHelper https://github.com/theforeman/foreman_salt/blob/master/lib/foreman_salt/engine.rb#L82
2. Salt extends the HostsController https://github.com/theforeman/foreman_salt/blob/master/lib/foreman_salt/engine.rb#L92 (this causes the controller to be loaded, including
the helper modules
3. Bootdisk extends the HostsHelper module, but this module doesn't get back into the controller, because it was already included
The solution I'm proposing is re-including the helpers at the end of the to_prepare phase: this way the controller should always get inside the latest version of the helpers
Updated by The Foreman Bot about 10 years ago
- Status changed from Assigned to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/1874 added
- Pull request deleted (
)
Updated by Dominic Cleal about 10 years ago
- Translation missing: en.field_release set to 27
Updated by Ivan Necas about 10 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset 94651a72552d90a811f8b5623ece86d1ef038028.