Bug #14824
closedundefined method `[]' for nil:NilClass - subscription-manager register
Description
Unsure what caused this change, but it seems like Engine.routes.router.recognize(link 1 below) is not returning params correctly any longer so the references in the case statement fail accessing id. Is this from rails4?
# subscription-manager register --org megacorp --activationkey minimal The system has been registered with ID: 71eba30e-d833-4804-b23a-aadb27aa6cf6 undefined method `[]' for nil:NilClass
The system is successfully registered to katello but further calls fail (fetching entitlements, etc.). Once registered 'subscription-manager refresh' will also exhibit the nil error for easy testing/reproducing.
Updated by Thomas McKay over 8 years ago
This workaround works but I don't know the implications or the real underlying problem/fix.
$ git diff WARNING: terminal is not fully functional - (press RETURN) diff --git a/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb b/app/controllers/katellindex 58431b4..51d6759 100644 --- a/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +++ b/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb @@ -435,7 +435,7 @@ module Katello def authorize_proxy_routes deny_access unless (authenticate || authenticate_client) - route, _, params = Engine.routes.router.recognize(request) do |rte, match, parameters| + route, params, _ = Engine.routes.router.recognize(request) do |rte, match, parameters| break rte, match, parameters if rte.name end
Updated by The Foreman Bot over 8 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/Katello/katello/pull/6004 added
Updated by Chris Duryee over 8 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset katello|421342f61d4b503d7dece36e5b8c95011da17f8c.
Updated by Eric Helms over 8 years ago
- Translation missing: en.field_release set to 86
Updated by Wagner Sartori Junior over 8 years ago
I'm running katello 3 rc5 now, and I was having the same "undefined method `[]' for nil:NilClass" problem.
I reverted the patch, to use the _ and now it's working again. Maybe my rails wasn't updated with katello 3 and there's some dependencies with wrong versions on the yum repositories somewhere.
Updated by Marvin Beckers over 8 years ago
I'm also running Katello 3.0 RC5 (brand new installation, set up today following standard procedure) and facing the same problem. Here's an extract from /var/log/foreman/production.log:
2016-05-25 14:02:20 [app] [I] Started GET "/rhsm/consumers/8ab39aa2-de2f-485b-8120-9b630ed89be4/certificates?serials=2798807315053081947" for <IP> at 2016-05-25 14:02:20 +0200 2016-05-25 14:02:20 [app] [I] Processing by Katello::Api::Rhsm::CandlepinProxiesController#get as JSON 2016-05-25 14:02:20 [app] [I] Parameters: {"serials"=>"2798807315053081947", "id"=>"8ab39aa2-de2f-485b-8120-9b630ed89be4"} 2016-05-25 14:02:20 [katello/cp_proxy] [E] NoMethodError: undefined method `[]' for nil:NilClass | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.rc5/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb:461:in `authorize_proxy_routes' [..]
I cannot confirm that reverting the patch works, but maybe I'm just doing it wrong. As RC5 is supposed to include the commit fixing this issue, this issue seems either not completely fixed or is another problem altogether. I'm not sure here, but will happily assist in debugging.
Updated by george lim over 8 years ago
I tried adding the _ back in but it still doesn't work for me. The same error occurs.
Updated by Justin Sherrill over 8 years ago
- Status changed from Closed to Assigned
- Assignee set to Chris Duryee
Reopening as this was reported by a user:
2016-06-01 01:43:58 [katello/cp_proxy] [E] NoMethodError: undefined method `[]' for nil:NilClass | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.rc5/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb:461:in `authorize_proxy_routes' | /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:424:in `block in make_lambda' | /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:143:in `call' | /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:143:in `block in halting_and_conditional' | /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:149:in `call' | /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:149:in `block in halting_and_conditional'
on subscription-manager-1.15.9-15.el7.centos.0.1.x86_64 when using an activation key
Updated by Eric Helms over 8 years ago
- Status changed from Assigned to Closed
I'm going to revert this to closed in favor of http://projects.theforeman.org/issues/15192 which opened around this specific issue so that this issue can remain as was.