Project

General

Profile

Actions

Refactor #18664

closed

Ignore missing actions in SmartProxyAuth calls to skip_before_action

Added by Dominic Cleal over 7 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Low
Assignee:
Category:
Rails
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

The SmartProxyAuth controller concern is designed to work on both the UI and API base controller and calls skip_before_action to skip require_login and set_taxonomy action filters. These are only present on the UI base controller though, but under Rails 5.0 this raises an exception:

gems/ruby-2.3.0@foreman/gems/activesupport-5.0.0/lib/active_support/callbacks.rb:641:in `block (2 levels) in skip_callback': Before process_action callback :require_login has not been defined (ArgumentError)
from gems/activesupport-5.0.0/lib/active_support/callbacks.rb:637:in `each'
from gems/activesupport-5.0.0/lib/active_support/callbacks.rb:637:in `block in skip_callback'
from gems/activesupport-5.0.0/lib/active_support/callbacks.rb:568:in `block in _update_callbacks'
from gems/activesupport-5.0.0/lib/active_support/callbacks.rb:566:in `reverse_each'
from gems/activesupport-5.0.0/lib/active_support/callbacks.rb:566:in `
_update_callbacks'
from gems/activesupport-5.0.0/lib/active_support/callbacks.rb:636:in `skip_callback'
from gems/actionpack-5.0.0/lib/abstract_controller/callbacks.rb:210:in `block (3 levels) in <module:ClassMethods>'
from gems/actionpack-5.0.0/lib/abstract_controller/callbacks.rb:93:in `block in _insert_callbacks'
from gems/actionpack-5.0.0/lib/abstract_controller/callbacks.rb:92:in `each'
from gems/actionpack-5.0.0/lib/abstract_controller/callbacks.rb:92:in `_insert_callbacks'
from gems/actionpack-5.0.0/lib/abstract_controller/callbacks.rb:209:in `block (2 levels) in <module:ClassMethods>'
from app/controllers/concerns/foreman/controller/smart_proxy_auth.rb:9:in `add_smart_proxy_filters'

I think it's harmless enough to pass the raise => false argument in on these two filters and ignore errors if the filters are undefined, since the concern has good test coverage. The concern is used in plugins too, so refactoring it into separate UI/API concerns may be disruptive.

Actions

Also available in: Atom PDF