Bug #5687
closedSave error when updating host/group params with array/json parameters
Description
When updating parameters, if there is an "array" param that has successfully validated when updating other parameters I get the error:
Warning!
Validation failed: Value is invalid array
I think this is because Foreman is escaping the JSON in the array again (double escape) which makes it invalid.
See attached screenshot for example.
Stack trace is:
ActiveRecord::RecordInvalid
Validation failed: Value is invalid array
app/models/concerns/host_common.rb:34:in `block in lookup_values_attributes='
app/models/concerns/host_common.rb:27:in `each_value'
app/models/concerns/host_common.rb:27:in `lookup_values_attributes='
app/controllers/hosts_controller.rb:112:in `block in update'
app/models/taxonomy.rb:49:in `block in no_taxonomy_scope'
app/models/taxonomy.rb:56:in `block (2 levels) in as_taxonomy'
app/models/concerns/foreman/thread_session.rb:143:in `as_location'
app/models/taxonomy.rb:55:in `block in as_taxonomy'
app/models/concerns/foreman/thread_session.rb:108:in `as_org'
app/models/taxonomy.rb:54:in `as_taxonomy'
app/models/taxonomy.rb:48:in `no_taxonomy_scope'
app/controllers/hosts_controller.rb:104:in `update'
app/models/concerns/foreman/thread_session.rb:33:in `clear_thread'
lib/middleware/catch_json_parse_errors.rb:9:in `call'!!
Files
Updated by Ollie Lawson over 10 years ago
- File Capture_1.PNG Capture_1.PNG added
My bad, screenshot attached this time
Updated by Dominic Cleal over 10 years ago
- Status changed from New to Feedback
I think this is bug #4639, as the screenshot shows a Ruby style hash (with => separators rather than : for JSON) when you're editing it.
Please try Foreman 1.4.4 which contains the fix: http://theforeman.org/manuals/1.4/index.html#Releasenotesfor1.4.4
Updated by Ollie Lawson over 10 years ago
Thanks Dominic, I'll update my version now and check.