Project

General

Profile

Bug #14518

unable to save report due to a host os misconfiguration

Added by Ohad Levy almost 4 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Reporting
Target version:
Difficulty:
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

in the past, it was possible to process reports and store them, regardless if the host / related objects were setup correctly.

2016-04-07T07:40:12 [app] [I] Started POST "/api/reports" for 10.35.27.149 at 2016-04-07 07:40:12 +0100
2016-04-07T07:40:12 [app] [I] Processing by Api::V2::ReportsController#create as JSON
2016-04-07T07:40:12 [app] [I]   Parameters: {"report"=>"[FILTERED]", "apiv"=>"v2"}
2016-04-07T07:40:12 [app] [I] processing report for 9680ae21-0b92-44e4-baa4-902adfd4f984
2016-04-07T07:40:12 [app] [I] Imported report for 9680ae21-0b92-44e4-baa4-902adfd4f984 in 0.18 seconds
2016-04-07T07:40:12 [app] [W] Action failed
 | ActiveRecord::RecordInvalid: Validation failed: Partition Table Community Kickstart Disklayout does not belong to CentOS 7.2 operating system, Medium CentOS mirror does not belong to CentOS 7.2 operating system, No PXELinux templates were found for this host, make sure you define at least one in your CentOS 7.2 settings
 | /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:40:12 [app] [I]   Rendered api/v2/errors/standard_error.json.rabl within api/v2/layouts/error_layout (0.6ms)
2016-04-07T07:40:12 [app] [I] Completed 500 Internal Server Error in 673ms (Views: 1.4ms | ActiveRecord: 244.7ms)

Related issues

Related to Foreman - Bug #14401: Host#refresh_global_status not persisting changes to the dbClosed2016-03-30
Related to Foreman - Bug #15679: "some interfaces are invalid" during host status db:migrateDuplicate2016-07-13
Has duplicate Foreman - Bug #15993: Salt reports importing failingDuplicate2016-08-05

Associated revisions

Revision 5d515720 (diff)
Added by Marek Hulán over 3 years ago

Fixes #14518, #14516 - status change ignores validations

Revision 53dc3013 (diff)
Added by Marek Hulán over 3 years ago

Fixes #14518, #14516 - status change ignores validations

(cherry picked from commit 5d5157202f0238eade7ce0b63195e2f397ca479c)

History

#1 Updated by Dominic Cleal almost 4 years ago

  • Related to Bug #14401: Host#refresh_global_status not persisting changes to the db added

#2 Updated by Dominic Cleal almost 4 years ago

  • Category set to Reporting
  • Legacy Backlogs Release (now unused) set to 136

#3 Updated by Marek Hulán almost 4 years ago

  • Status changed from New to Assigned
  • Assignee set to Marek Hulán

Similarly like in #14516, I'm not sure whether this is a bug. We should not let this invalid host status happen in the first place. Failing on save at least let user know that something went wrong, which is especially helpful when you use foreman-tasks and background processing. The "fix" is very simple so I open the PR and let the discussion happen there.

#4 Updated by The Foreman Bot almost 4 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/3447 added

#5 Updated by Dominic Cleal almost 4 years ago

  • Legacy Backlogs Release (now unused) changed from 136 to 161

#6 Updated by Dominic Cleal over 3 years ago

  • Related to Bug #15679: "some interfaces are invalid" during host status db:migrate added

#7 Updated by Dominic Cleal over 3 years ago

  • Legacy Backlogs Release (now unused) changed from 161 to 175

#8 Updated by Marek Hulán over 3 years ago

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

#9 Updated by Dominic Cleal over 3 years ago

  • Has duplicate Bug #15993: Salt reports importing failing added

#10 Updated by Marek Hulán over 3 years ago

  • Target version set to 1.6.3

Also available in: Atom PDF