Bug #14516
closedHost::Base#domain_id= delegated to primary_interface.domain_id=, but primary_interface is nil
Description
Started POST "/api/reports" for 10.35.27.149 at 2016-04-07 07:51:26 +0100 2016-04-07T07:51:26 [app] [I] Processing by Api::V2::ReportsController#create as JSON 2016-04-07T07:51:26 [app] [I] Parameters: {"report"=>"[FILTERED]", "apiv"=>"v2"} 2016-04-07T07:51:26 [app] [I] processing report for host.example.com 2016-04-07T07:51:26 [app] [I] Imported report for host.example.com in 0.32 seconds 2016-04-07T07:51:27 [app] [W] Action failed | Module::DelegationError: Host::Base#domain_id= delegated to primary_interface.domain_id=, but primary_interface is nil: #<Host::Managed id: 194, name: "host.example.com", last_compile: "2016-04-07 06:51:17", last_report: "2016-04-07 06:50:49", updated_at: "2016-04-07 06:51:26", created_at: "2011-05-25 11:02:08", root_pass: "", architecture_id: 1, operatingsystem_id: 56, environment_id: 1, ptable_id: 113, medium_id: 3, build: false, comment: "", disk: "", installed_at: nil, model_id: 10, hostgroup_id: 3, owner_id: 15, owner_type: "User", enabled: true, puppet_ca_proxy_id: 7, managed: true, use_image: nil, image_file: nil, uuid: nil, compute_resource_id: nil, puppet_proxy_id: 7, certname: "host.example.com", image_id: nil, organization_id: 1, location_id: 3, type: "Host::Managed", otp: nil, realm_id: nil, compute_profile_id: nil, provision_method: "build", grub_pass: "", discovery_rule_id: nil, expired_on: nil, lookup_value_matcher: "fqdn=host.example.com", global_status: 2> | /home/foreman/git/foreman/app/models/host/base.rb:116:in `rescue in domain_id=' | /home/foreman/git/foreman/app/models/host/base.rb:116:in `domain_id=' | /home/foreman/git/foreman/app/models/host/managed.rb:975:in `block in assign_hostgroup_attributes' | /home/foreman/git/foreman/app/models/host/managed.rb:972:in `each' | /home/foreman/git/foreman/app/models/host/managed.rb:972:in `assign_hostgroup_attributes' | /home/foreman/git/foreman/app/models/host/managed.rb:613:in `set_hostgroup_defaults' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:429:in `block in make_lambda' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:161:in `call' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:161:in `block in halting' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:501:in `call' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:501:in `block in call' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:501:in `each' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:501:in `call' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:86:in `run_callbacks' | /home/foreman/gems/gems/activemodel-4.1.14.2/lib/active_model/validations/callbacks.rb:111:in `run_validations!' | /home/foreman/gems/gems/activemodel-4.1.14.2/lib/active_model/validations.rb:318:in `valid?' | /home/foreman/gems/gems/activerecord-4.1.14.2/lib/active_record/validations.rb:70:in `valid?' | /home/foreman/git/foreman/app/models/concerns/orchestration.rb:69:in `valid?' | /home/foreman/gems/gems/activerecord-4.1.14.2/lib/active_record/validations.rb:77:in `perform_validations' | /home/foreman/gems/gems/activerecord-4.1.14.2/lib/active_record/validations.rb:57:in `save!' | /home/foreman/gems/gems/activerecord-4.1.14.2/lib/active_record/attribute_methods/dirty.rb:29:in `save!' | /home/foreman/gems/gems/activerecord-4.1.14.2/lib/active_record/transactions.rb:273:in `block in save!' | /home/foreman/gems/gems/activerecord-4.1.14.2/lib/active_record/transactions.rb:329:in `block in with_transaction_returning_status' | /home/foreman/gems/gems/activerecord-4.1.14.2/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `block in transaction' | /home/foreman/gems/gems/activerecord-4.1.14.2/lib/active_record/connection_adapters/abstract/database_statements.rb:209:in `within_new_transaction' | /home/foreman/gems/gems/activerecord-4.1.14.2/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `transaction' | /home/foreman/gems/gems/activerecord-4.1.14.2/lib/active_record/transactions.rb:208:in `transaction' | /home/foreman/gems/gems/activerecord-4.1.14.2/lib/active_record/transactions.rb:326:in `with_transaction_returning_status' | /home/foreman/gems/gems/activerecord-4.1.14.2/lib/active_record/transactions.rb:273:in `save!' | /home/foreman/git/foreman/app/models/host/managed.rb:848:in `refresh_global_status!' | /home/foreman/git/foreman/app/models/host/managed.rb:857:in `refresh_statuses' | /home/foreman/git/foreman/app/services/report_importer.rb:43:in `import' | /home/foreman/git/foreman/app/services/report_importer.rb:20:in `import' | /home/foreman/git/foreman/app/models/config_report.rb:27:in `import' | /home/foreman/git/foreman/app/controllers/api/v2/reports_controller.rb:40:in `create' | /home/foreman/gems/gems/actionpack-4.1.14.2/lib/action_controller/metal/implicit_render.rb:4:in `send_action' | /home/foreman/gems/gems/actionpack-4.1.14.2/lib/abstract_controller/base.rb:189:in `process_action' | /home/foreman/gems/gems/actionpack-4.1.14.2/lib/action_controller/metal/rendering.rb:10:in `process_action' | /home/foreman/gems/gems/actionpack-4.1.14.2/lib/abstract_controller/callbacks.rb:20:in `block in process_action' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:113:in `call' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:113:in `call' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:552:in `block (2 levels) in compile' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:502:in `call' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:502:in `call' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:495:in `block (2 levels) in around' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:306:in `call' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:306:in `block (2 levels) in halting' | /home/foreman/git/foreman/app/controllers/api/v2/base_controller.rb:152:in `disable_json_root' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:429:in `block in make_lambda' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:305:in `call' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:305:in `block in halting' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:494:in `call' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:494:in `block in around' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:502:in `call' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:502:in `call' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:495:in `block (2 levels) in around' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:306:in `call' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:306:in `block (2 levels) in halting' | /home/foreman/gems/gems/rails-observers-0.1.2/lib/rails/observers/action_controller/caching/sweeping.rb:73:in `around' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:452:in `public_send' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:452:in `block in make_lambda' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:305:in `call' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:305:in `block in halting' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:494:in `call' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:494:in `block in around' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:502:in `call' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:502:in `call' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:495:in `block (2 levels) in around' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:306:in `call' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:306:in `block (2 levels) in halting' | /home/foreman/git/foreman/app/controllers/concerns/application_shared.rb:13:in `set_timezone' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:429:in `block in make_lambda' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:305:in `call' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:305:in `block in halting' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:494:in `call' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:494:in `block in around' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:502:in `call' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:502:in `call' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:495:in `block (2 levels) in around' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:306:in `call' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:306:in `block (2 levels) in halting' | /home/foreman/git/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:429:in `block in make_lambda' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:305:in `call' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:305:in `block in halting' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:494:in `call' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:494:in `block in around' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:502:in `call' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:502:in `call' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:495:in `block (2 levels) in around' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:306:in `call' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:306:in `block (2 levels) in halting' | /home/foreman/gems/gems/rails-observers-0.1.2/lib/rails/observers/action_controller/caching/sweeping.rb:73:in `around' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:452:in `public_send' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:452:in `block in make_lambda' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:305:in `call' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:305:in `block in halting' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:494:in `call' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:494:in `block in around' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:502:in `call' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:502:in `call' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:86:in `run_callbacks' | /home/foreman/gems/gems/actionpack-4.1.14.2/lib/abstract_controller/callbacks.rb:19:in `process_action' | /home/foreman/gems/gems/actionpack-4.1.14.2/lib/action_controller/metal/rescue.rb:29:in `process_action' | /home/foreman/gems/gems/actionpack-4.1.14.2/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/notifications.rb:159:in `block in instrument' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/notifications/instrumenter.rb:20:in `instrument' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/notifications.rb:159:in `instrument' | /home/foreman/gems/gems/actionpack-4.1.14.2/lib/action_controller/metal/instrumentation.rb:30:in `process_action' | /home/foreman/gems/gems/actionpack-4.1.14.2/lib/action_controller/metal/params_wrapper.rb:250:in `process_action' | /home/foreman/gems/gems/activerecord-4.1.14.2/lib/active_record/railties/controller_runtime.rb:18:in `process_action' | /home/foreman/gems/gems/actionpack-4.1.14.2/lib/abstract_controller/base.rb:136:in `process' | /home/foreman/gems/gems/actionview-4.1.14.2/lib/action_view/rendering.rb:30:in `process' | /home/foreman/gems/gems/actionpack-4.1.14.2/lib/action_controller/metal.rb:196:in `dispatch' | /home/foreman/gems/gems/actionpack-4.1.14.2/lib/action_controller/metal/rack_delegation.rb:13:in `dispatch' | /home/foreman/gems/gems/actionpack-4.1.14.2/lib/action_controller/metal.rb:232:in `block in action' | /home/foreman/gems/gems/actionpack-4.1.14.2/lib/action_dispatch/routing/route_set.rb:80:in `call' | /home/foreman/gems/gems/actionpack-4.1.14.2/lib/action_dispatch/routing/route_set.rb:80:in `dispatch' | /home/foreman/gems/gems/actionpack-4.1.14.2/lib/action_dispatch/routing/route_set.rb:48:in `call' | /home/foreman/gems/gems/actionpack-4.1.14.2/lib/action_dispatch/routing/mapper.rb:45:in `call' | /home/foreman/gems/gems/actionpack-4.1.14.2/lib/action_dispatch/journey/router.rb:73:in `block in call' | /home/foreman/gems/gems/actionpack-4.1.14.2/lib/action_dispatch/journey/router.rb:59:in `each' | /home/foreman/gems/gems/actionpack-4.1.14.2/lib/action_dispatch/journey/router.rb:59:in `call' | /home/foreman/gems/gems/actionpack-4.1.14.2/lib/action_dispatch/routing/route_set.rb:690:in `call' | /home/foreman/gems/gems/apipie-rails-0.3.6/lib/apipie/static_dispatcher.rb:65:in `call' | /home/foreman/gems/gems/apipie-rails-0.3.6/lib/apipie/extractor/recorder.rb:132:in `call' | /home/foreman/gems/gems/apipie-rails-0.3.6/lib/apipie/middleware/checksum_in_headers.rb:27:in `call' | /home/foreman/gems/gems/rack-1.5.5/lib/rack/etag.rb:23:in `call' | /home/foreman/gems/gems/rack-1.5.5/lib/rack/conditionalget.rb:35:in `call' | /home/foreman/gems/gems/rack-1.5.5/lib/rack/head.rb:11:in `call' | /home/foreman/gems/gems/actionpack-4.1.14.2/lib/action_dispatch/middleware/params_parser.rb:27:in `call' | /home/foreman/git/foreman/lib/middleware/catch_json_parse_errors.rb:9:in `call' | /home/foreman/gems/gems/actionpack-4.1.14.2/lib/action_dispatch/middleware/flash.rb:254:in `call' | /home/foreman/gems/gems/rack-1.5.5/lib/rack/session/abstract/id.rb:225:in `context' | /home/foreman/gems/gems/rack-1.5.5/lib/rack/session/abstract/id.rb:220:in `call' | /home/foreman/gems/gems/actionpack-4.1.14.2/lib/action_dispatch/middleware/cookies.rb:562:in `call' | /home/foreman/gems/gems/activerecord-4.1.14.2/lib/active_record/query_cache.rb:36:in `call' | /home/foreman/gems/gems/activerecord-4.1.14.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:621:in `call' | /home/foreman/gems/gems/actionpack-4.1.14.2/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/callbacks.rb:82:in `run_callbacks' | /home/foreman/gems/gems/actionpack-4.1.14.2/lib/action_dispatch/middleware/callbacks.rb:27:in `call' | /home/foreman/gems/gems/actionpack-4.1.14.2/lib/action_dispatch/middleware/remote_ip.rb:76:in `call' | /home/foreman/gems/gems/actionpack-4.1.14.2/lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call' | /home/foreman/gems/gems/actionpack-4.1.14.2/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call' | /home/foreman/gems/gems/railties-4.1.14.2/lib/rails/rack/logger.rb:38:in `call_app' | /home/foreman/gems/gems/railties-4.1.14.2/lib/rails/rack/logger.rb:22:in `call' | /home/foreman/gems/gems/quiet_assets-1.1.0/lib/quiet_assets.rb:27:in `call_with_quiet_assets' | /home/foreman/gems/gems/actionpack-4.1.14.2/lib/action_dispatch/middleware/request_id.rb:21:in `call' | /home/foreman/gems/gems/rack-1.5.5/lib/rack/methodoverride.rb:21:in `call' | /home/foreman/gems/gems/rack-1.5.5/lib/rack/runtime.rb:17:in `call' | /home/foreman/gems/gems/activesupport-4.1.14.2/lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call' | /home/foreman/gems/gems/actionpack-4.1.14.2/lib/action_dispatch/middleware/static.rb:84:in `call' | /home/foreman/gems/gems/rack-1.5.5/lib/rack/sendfile.rb:112:in `call' | /home/foreman/gems/gems/railties-4.1.14.2/lib/rails/engine.rb:514:in `call' | /home/foreman/gems/gems/railties-4.1.14.2/lib/rails/application.rb:144:in `call' | /home/foreman/gems/gems/railties-4.1.14.2/lib/rails/railtie.rb:194:in `public_send' | /home/foreman/gems/gems/railties-4.1.14.2/lib/rails/railtie.rb:194:in `method_missing' | /home/foreman/gems/gems/rack-1.5.5/lib/rack/builder.rb:138:in `call' | /home/foreman/gems/gems/rack-1.5.5/lib/rack/urlmap.rb:65:in `block in call' | /home/foreman/gems/gems/rack-1.5.5/lib/rack/urlmap.rb:50:in `each' | /home/foreman/gems/gems/rack-1.5.5/lib/rack/urlmap.rb:50:in `call' | /root/.gem/gems/passenger-5.0.7/lib/phusion_passenger/rack/thread_handler_extension.rb:89:in `process_request' | /root/.gem/gems/passenger-5.0.7/lib/phusion_passenger/request_handler/thread_handler.rb:155:in `accept_and_process_next_request' | /root/.gem/gems/passenger-5.0.7/lib/phusion_passenger/request_handler/thread_handler.rb:110:in `main_loop' | /root/.gem/gems/passenger-5.0.7/lib/phusion_passenger/request_handler.rb:414:in `block (3 levels) in start_threads' | /root/.gem/gems/passenger-5.0.7/lib/phusion_passenger/utils.rb:111:in `block in create_thread_and_abort_on_exception' | /home/foreman/gems/gems/logging-2.1.0/lib/logging/diagnostic_context.rb:450:in `call' | /home/foreman/gems/gems/logging-2.1.0/lib/logging/diagnostic_context.rb:450:in `block in create_with_logging_context' 2016-04-07T07:51:27 [app] [I] Rendered api/v2/errors/standard_error.json.rabl within api/v2/layouts/error_layout (1.7ms) 2016-04-07T07:51:27 [app] [I] Completed 500 Internal Server Error in 509ms (Views: 44.1ms | ActiveRecord: 185.3ms)
Updated by Ohad Levy over 8 years ago
- Related to Bug #14264: Getting 500 when creating host through API and not specifying any interface attributes added
Updated by Ohad Levy over 8 years ago
reverting 308f611 resolve the problem for me.
Updated by Dominic Cleal over 8 years ago
- Category set to Network
- Translation missing: en.field_release set to 141
Does reverting b3d3d65 instead also fix the problem? Is this is a new host, or updating an existing one? Does it have a domain set already?
Updated by Dominic Cleal over 8 years ago
Ohad, can you please supply the info above and test with the other commit? I'd rather remove that from this release.
Updated by Ohad Levy over 8 years ago
Dominic Cleal wrote:
Is this is a new host, or updating an existing one? Does it have a domain set already?
existing host, from some reason, it currently has no domain (it was provisionged with one).
Looking at the audit table, I can see some time ago (around 3 months) the following audits:
{"mac"=>["52:54:00:3E:06:23", "52:54:00:3e:06:23"]}
followed by
{"mac"=>["52:54:00:3e:06:23", "52:54:00:3E:06:23"], "primary_interface"=>[nil, "eth0"]}
Updated by Ohad Levy over 8 years ago
Dominic Cleal wrote:
Does reverting b3d3d65 instead also fix the problem?
yes it does! - thanks
Updated by Dominic Cleal over 8 years ago
- Related to Bug #14401: Host#refresh_global_status not persisting changes to the db added
Updated by Dominic Cleal over 8 years ago
- Translation missing: en.field_release changed from 141 to 136
Updated by Marek Hulán over 8 years ago
The change in #14401 only added host saving to the report import action. It seems that the host is invalid and therefore the action fails. In such case I don't think this is a bug, the DB is in inconsistent state. We could skip validations, so the #set_hostgroup_defaults would not be triggered but that's just masking the root cause.
Updated by The Foreman Bot over 8 years ago
- Status changed from New to Ready For Testing
- Assignee set to Marek Hulán
- Pull request https://github.com/theforeman/foreman/pull/3447 added
Updated by Dominic Cleal over 8 years ago
- Translation missing: en.field_release changed from 136 to 161
Updated by Dominic Cleal over 8 years ago
- Translation missing: en.field_release changed from 161 to 175
Updated by Marek Hulán over 8 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset 5d5157202f0238eade7ce0b63195e2f397ca479c.