Bug #13622
closed500 when updating a host with null "nested" params
Description
The error:
2016-02-09T14:45:14 [app] [W] Action failed | AbstractController::DoubleRenderError: Render and/or redirect were called multiple times in this action. Please note that you may only call render OR redirect, and at most once per action. Also note that neither redirect nor render terminate execution of the action, so if you want to exit an action after redirecting, you need to do something like "redirect_to(...) and return". | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.5/lib/action_controller/metal/rendering.rb:15:in `render' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.5/lib/action_controller/metal/instrumentation.rb:41:in `block (2 levels) in render' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/core_ext/benchmark.rb:12:in `block in ms' | /home/vagrant/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/benchmark.rb:303:in `realtime' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/core_ext/benchmark.rb:12:in `ms' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.5/lib/action_controller/metal/instrumentation.rb:41:in `block in render' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.5/lib/action_controller/metal/instrumentation.rb:84:in `cleanup_view_runtime' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activerecord-4.1.5/lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.5/lib/action_controller/metal/instrumentation.rb:40:in `render' | /home/vagrant/foreman/app/controllers/api/base_controller.rb:86:in `not_found' | /home/vagrant/foreman/app/controllers/api/base_controller.rb:230:in `block in not_found_if_nested_id_exists' | /home/vagrant/foreman/app/controllers/api/base_controller.rb:228:in `each' | /home/vagrant/foreman/app/controllers/api/base_controller.rb:228:in `not_found_if_nested_id_exists' | /home/vagrant/foreman/app/controllers/api/base_controller.rb:216:in `find_optional_nested_object' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:424:in `block in make_lambda' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:143:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:143:in `block in halting_and_conditional' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:149:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:149:in `block in halting_and_conditional' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:166:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:166:in `block in halting' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:299:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:299:in `block (2 levels) in halting' | /home/vagrant/foreman/app/controllers/api/v2/base_controller.rb:152:in `disable_json_root' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:424:in `block in make_lambda' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:298:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:298:in `block in halting' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:166:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:166:in `block in halting' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:149:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:149:in `block in halting_and_conditional' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:229:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:229:in `block in halting' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:299:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:299:in `block (2 levels) in halting' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/rails-observers-0.1.2/lib/rails/observers/action_controller/caching/sweeping.rb:73:in `around' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:447:in `public_send' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:447:in `block in make_lambda' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:298:in `block in halting' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:299:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:299:in `block (2 levels) in halting' | /home/vagrant/foreman/app/controllers/concerns/application_shared.rb:13:in `set_timezone' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:424:in `block in make_lambda' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:298:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:298:in `block in halting' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:149:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:149:in `block in halting_and_conditional' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:149:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:149:in `block in halting_and_conditional' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:166:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:166:in `block in halting' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:166:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:166:in `block in halting' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:149:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:149:in `block in halting_and_conditional' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:166:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:166:in `block in halting' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:149:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:149:in `block in halting_and_conditional' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:229:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:229:in `block in halting' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:299:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:299:in `block (2 levels) in halting' | /home/vagrant/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:424:in `block in make_lambda' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:298:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:298:in `block in halting' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:229:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:229:in `block in halting' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:166:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:166:in `block in halting' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:166:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:166:in `block in halting' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:166:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:166:in `block in halting' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:299:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:299:in `block (2 levels) in halting' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/rails-observers-0.1.2/lib/rails/observers/action_controller/caching/sweeping.rb:73:in `around' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:447:in `public_send' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:447:in `block in make_lambda' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:298:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:298:in `block in halting' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:149:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:149:in `block in halting_and_conditional' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:86:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:86:in `run_callbacks' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.5/lib/abstract_controller/callbacks.rb:19:in `process_action' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.5/lib/action_controller/metal/rescue.rb:29:in `process_action' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.5/lib/action_controller/metal/instrumentation.rb:31:in `block in process_action' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/notifications.rb:159:in `block in instrument' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/notifications/instrumenter.rb:20:in `instrument' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/notifications.rb:159:in `instrument' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.5/lib/action_controller/metal/instrumentation.rb:30:in `process_action' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.5/lib/action_controller/metal/params_wrapper.rb:250:in `process_action' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activerecord-4.1.5/lib/active_record/railties/controller_runtime.rb:18:in `process_action' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.5/lib/abstract_controller/base.rb:136:in `process' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/actionview-4.1.5/lib/action_view/rendering.rb:30:in `process' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.5/lib/action_controller/metal.rb:196:in `dispatch' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.5/lib/action_controller/metal/rack_delegation.rb:13:in `dispatch' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.5/lib/action_controller/metal.rb:232:in `block in action' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.5/lib/action_dispatch/routing/route_set.rb:82:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.5/lib/action_dispatch/routing/route_set.rb:82:in `dispatch' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.5/lib/action_dispatch/routing/route_set.rb:50:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.5/lib/action_dispatch/routing/mapper.rb:45:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.5/lib/action_dispatch/journey/router.rb:71:in `block in call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.5/lib/action_dispatch/journey/router.rb:59:in `each' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.5/lib/action_dispatch/journey/router.rb:59:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.5/lib/action_dispatch/routing/route_set.rb:678:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.5/lib/action_dispatch/middleware/static.rb:64:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.5/lib/action_dispatch/middleware/static.rb:64:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/apipie-rails-0.3.5/lib/apipie/static_dispatcher.rb:65:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/bullet-5.0.0/lib/bullet/rack.rb:12:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/apipie-rails-0.3.5/lib/apipie/extractor/recorder.rb:132:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/apipie-rails-0.3.5/lib/apipie/middleware/checksum_in_headers.rb:27:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/rack-openid-1.4.2/lib/rack/openid.rb:98:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/rack-1.5.5/lib/rack/etag.rb:23:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/rack-1.5.5/lib/rack/conditionalget.rb:35:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/rack-1.5.5/lib/rack/head.rb:11:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.5/lib/action_dispatch/middleware/params_parser.rb:27:in `call' | /home/vagrant/foreman/lib/middleware/catch_json_parse_errors.rb:9:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.5/lib/action_dispatch/middleware/flash.rb:254:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/rack-1.5.5/lib/rack/session/abstract/id.rb:225:in `context' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/rack-1.5.5/lib/rack/session/abstract/id.rb:220:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.5/lib/action_dispatch/middleware/cookies.rb:560:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activerecord-4.1.5/lib/active_record/query_cache.rb:36:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activerecord-4.1.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:621:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activerecord-4.1.5/lib/active_record/migration.rb:380:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.5/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:82:in `run_callbacks' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.5/lib/action_dispatch/middleware/callbacks.rb:27:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.5/lib/action_dispatch/middleware/reloader.rb:73:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.5/lib/action_dispatch/middleware/remote_ip.rb:76:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.5/lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.5/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/railties-4.1.5/lib/rails/rack/logger.rb:38:in `call_app' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/railties-4.1.5/lib/rails/rack/logger.rb:22:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/quiet_assets-1.1.0/lib/quiet_assets.rb:27:in `call_with_quiet_assets' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.5/lib/action_dispatch/middleware/request_id.rb:21:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/rack-1.5.5/lib/rack/methodoverride.rb:21:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/rack-1.5.5/lib/rack/runtime.rb:17:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.5/lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/rack-1.5.5/lib/rack/lock.rb:17:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.5/lib/action_dispatch/middleware/static.rb:64:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/rack-1.5.5/lib/rack/sendfile.rb:112:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/railties-4.1.5/lib/rails/engine.rb:514:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/railties-4.1.5/lib/rails/application.rb:144:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/railties-4.1.5/lib/rails/railtie.rb:194:in `public_send' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/railties-4.1.5/lib/rails/railtie.rb:194:in `method_missing' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/rack-1.5.5/lib/rack/builder.rb:138:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/rack-1.5.5/lib/rack/urlmap.rb:65:in `block in call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/rack-1.5.5/lib/rack/urlmap.rb:50:in `each' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/rack-1.5.5/lib/rack/urlmap.rb:50:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/rack-1.5.5/lib/rack/lock.rb:17:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/rack-1.5.5/lib/rack/content_length.rb:14:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/rack-1.5.5/lib/rack/handler/webrick.rb:60:in `service' | /home/vagrant/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service' | /home/vagrant/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run' | /home/vagrant/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/logging-2.0.0/lib/logging/diagnostic_context.rb:448:in `call' | /home/vagrant/.rvm/gems/ruby-2.2.0/gems/logging-2.0.0/lib/logging/diagnostic_context.rb:448:in `block in create_with_logging_context' 2016-02-09T14:45:14 [app] [I] Completed 500 Internal Server Error in 25ms 2016-02-09T14:45:14 [app] [F] | AbstractController::DoubleRenderError (Render and/or redirect were called multiple times in this action. Please note that you may only call render OR redirect, and at most once per action. Also note that neither redirect nor render terminate execution of the action, so if you want to exit an action after redirecting, you need to do something like "redirect_to(...) and return".): | app/controllers/api/v2/base_controller.rb:143:in `render_error' | app/controllers/api/base_controller.rb:22:in `block in <class:BaseController>' | lib/middleware/catch_json_parse_errors.rb:9:in `call' | |
Here is the JSON I used:
{ "environment_id": null, "hostgroup_id": null, "organization_id": 1, "location_id": 2, "name": "new hostname" }
The problem appears to be here:
https://github.com/theforeman/foreman/blob/develop/app/controllers/api/base_controller.rb#L227-L233
If more than one of these special attributes are included and also null then the result is more than one render:
(byebug) allowed_nested_id ["hostgroup_id", "location_id", "organization_id", "environment_id"]
I would expect null attributes to be accepted and that they would remove the association. If this is not a valid assumption then the API should provide an appropriate error.
h3. Steps to Reproduce
- PUT to a host with JSON similar to the above
- Note 500 ISE
Updated by Swapnil Abnave over 7 years ago
Hi Walden,
I would expect null attributes to be accepted and that they would remove the association
Yes that should ideally work. I'll have a look at this.
- PUT to a host with JSON similar to the above
I think the JSON structure needs to be per API documentation : https://theforeman.org/api/1.12/apidoc/v2/hosts/update.html
I tried with following JSON and it worked (didn't raise any 500 Error)
{
"host": {
"environment_id": null,
"hostgroup_id": null,
"organization_id": 1,
"location_id": 2,
"name": "new hostname"
}
}
Updated by Walden Raines over 7 years ago
Swapnil Abnave wrote:
I think the JSON structure needs to be per API documentation : https://theforeman.org/api/1.12/apidoc/v2/hosts/update.html
We'll have to agree to disagree on the usefulness (read superfluousness) of wrapping everything in 'host' :)
Updated by Walden Raines over 7 years ago
Swapnil Abnave wrote:
I tried with following JSON and it worked (didn't raise any 500 Error)
Perhaps this has been fixed then? As long as you can supply null values to the API and it removes the association than I think we can call this fixed.
Updated by Swapnil Abnave over 7 years ago
Yes, `null` values are getting set with following request payload.
{
"host": {
"environment_id": null,
"hostgroup_id": null,
"organization_id": 1,
"location_id": 2,
"name": "new hostname"
}
}
This issue can be closed.
Updated by Amit Karsale almost 7 years ago
- Status changed from New to Closed
Closed based on the comments shared. If its still a bug feel free to re-open it.