Project

General

Profile

Bug #19417

keep_params throws error if params don't contain top level hash

Added by Tomer Brisker almost 6 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Rails
Target version:
Difficulty:
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:
Red Hat JIRA:

Description

This can be reproduced in discovery by trying to provision a host and selecting an architecture

 | NoMethodError (undefined method `has_key?' for nil:NilClass):
 |   app/controllers/concerns/foreman/controller/parameters/keep_param.rb:11:in `block in keep_param'
 |   app/controllers/concerns/foreman/controller/parameters/keep_param.rb:10:in `each'
 |   app/controllers/concerns/foreman/controller/parameters/keep_param.rb:10:in `inject'
 |   app/controllers/concerns/foreman/controller/parameters/keep_param.rb:10:in `keep_param'
 |   app/controllers/concerns/foreman/controller/parameters/host.rb:34:in `host_params'
 |   app/controllers/concerns/foreman/controller/host_details.rb:58:in `item_params'
 |   app/controllers/concerns/foreman/controller/host_details.rb:50:in `block in assign_parameter'
 |   app/models/taxonomy.rb:72:in `block (2 levels) in as_taxonomy'
 |   app/models/concerns/foreman/thread_session.rb:150:in `as_location'
 |   app/models/taxonomy.rb:71:in `block in as_taxonomy'
 |   app/models/concerns/foreman/thread_session.rb:115:in `as_org'
 |   app/models/taxonomy.rb:70:in `as_taxonomy'
 |   app/controllers/concerns/foreman/controller/host_details.rb:49:in `assign_parameter'
 |   app/controllers/concerns/foreman/controller/host_details.rb:8:in `architecture_selected'
 |   app/controllers/concerns/application_shared.rb:15:in `set_timezone'
 |   app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
 |   app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
 |   lib/middleware/catch_json_parse_errors.rb:8:in `call'
 |   lib/middleware/tagged_logging.rb:18:in `call'
 | 


Related issues

Related to Foreman - Feature #3917: Add strong_parameters to foremanClosed2013-12-19

Associated revisions

Revision d14f17f6 (diff)
Added by Tomer Brisker almost 6 years ago

Fixes #19417 - Safely check params for nested keys

Revision c9775051 (diff)
Added by Tomer Brisker over 5 years ago

Fixes #19417 - Safely check params for nested keys

(cherry picked from commit d14f17f637d4eb9a1156b101dd6852cf41219e06)

History

#1 Updated by The Foreman Bot almost 6 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Tomer Brisker
  • Pull request https://github.com/theforeman/foreman/pull/4491 added

#2 Updated by Dominic Cleal almost 6 years ago

  • Category set to Rails

#3 Updated by Anonymous almost 6 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#4 Updated by Tomer Brisker almost 6 years ago

  • Legacy Backlogs Release (now unused) set to 209

Setting this to 1.15.0 since discovery (and possibly other plugins) would be broken otherwise.

#5 Updated by Dominic Cleal almost 6 years ago

This doesn't look like a regression, keep_param has always expected the top level hash ever since commit 1261280. Why is it any different in 1.15.0?

#6 Updated by Tomer Brisker almost 6 years ago

  • Related to Feature #3917: Add strong_parameters to foreman added

#7 Updated by Tomer Brisker almost 6 years ago

It's possible this has actually been broken for a while but hasn't been discovered yet due to lack of tests.

#8 Updated by Dominic Cleal almost 6 years ago

  • Legacy Backlogs Release (now unused) deleted (209)

I'll unset the field then, and let a release manager set it to a future bug fix release then. It missed 1.15.0 and doesn't appear to be a regression in the current RCs.

#9 Updated by Tomer Brisker almost 6 years ago

Further digging led me to find #19436 which, which is what caused this issue to appear (sending discovered_host param to the hosts controller instead of the host controller). I agree this fix can wait for next release, the other one is a regression though.

#10 Updated by Daniel Lobato Garcia over 5 years ago

  • Legacy Backlogs Release (now unused) set to 276

#11 Updated by Daniel Lobato Garcia over 5 years ago

Setting to 1.15.3 as Raboo on IRC comments this is blocking the discovery workflow in their installation

Also available in: Atom PDF