Bug #19417
closedkeep_params throws error if params don't contain top level hash
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' |
Updated by The Foreman Bot over 7 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
Updated by Anonymous over 7 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset d14f17f637d4eb9a1156b101dd6852cf41219e06.
Updated by Tomer Brisker over 7 years ago
- Translation missing: en.field_release set to 209
Setting this to 1.15.0 since discovery (and possibly other plugins) would be broken otherwise.
Updated by Dominic Cleal over 7 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?
Updated by Tomer Brisker over 7 years ago
- Related to Feature #3917: Add strong_parameters to foreman added
Updated by Tomer Brisker over 7 years ago
It's possible this has actually been broken for a while but hasn't been discovered yet due to lack of tests.
Updated by Dominic Cleal over 7 years ago
- Translation missing: en.field_release 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.
Updated by Tomer Brisker over 7 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.
Updated by Daniel Lobato Garcia over 7 years ago
- Translation missing: en.field_release set to 276
Updated by Daniel Lobato Garcia over 7 years ago
Setting to 1.15.3 as Raboo on IRC comments this is blocking the discovery workflow in their installation