Actions
Bug #23715
closedFacts are not parsed for the OS
Difficulty:
Triaged:
Description
As reported on https://community.theforeman.org/t/500-server-error-internal-server-error-for-url-https-ansible01-localhost-local-api-v2-hosts-facts
I can successfully reproduce it on my devel machine:
2018-05-28T14:00:03 [I|app|] Started POST "/api/v2/hosts/facts" for ::1 at 2018-05-28 14:00:03 +0000 2018-05-28T14:00:03 [I|app|49c53] Processing by Api::V2::HostsController#facts as JSON 2018-05-28T14:00:03 [I|app|49c53] Parameters: {"name"=>"centos7-devel.lobatolan.home", "facts"=>"[FILTERED]", "apiv"=>"v2", "host"=>{"name"=>"centos7-devel.lobatolan.home"}} 2018-05-28T14:00:03 [I|app|49c53] Current user: foreman_api_admin (administrator) 2018-05-28T14:00:03 [I|app|49c53] Import facts for 'centos7-devel.lobatolan.home' completed. Added: 2, Updated: 0, Deleted 600 facts 2018-05-28T14:00:03 [W|app|49c53] DEPRECATION WARNING: The behavior of `changed` inside of after callbacks will be changing in the next version of Rails. The new return value will reflect the behavior of calling the method after `save` returned (e.g. the opposite of what it returns now). To maintain the current behavior, use `saved_changes.keys` instead. (called from block in prepended at /home/vagrant/foreman_openscap/app/models/concerns/foreman_openscap/host_extensions.rb:25) 2018-05-28T14:00:03 [W|app|49c53] DEPRECATION WARNING: The behavior of `changed_attributes` inside of after callbacks will be changing in the next version of Rails. The new return value will reflect the behavior of calling the method after `save` returned (e.g. the opposite of what it returns now). To maintain the current behavior, use `saved_changes.transform_values(&:first)` instead. (called from block in prepended at /home/vagrant/foreman_openscap/app/models/concerns/foreman_openscap/host_extensions.rb:25) 2018-05-28T14:00:03 [W|app|49c53] DEPRECATION WARNING: The behavior of `attribute_changed?` inside of after callbacks will be changing in the next version of Rails. The new return value will reflect the behavior of calling the method after `save` returned (e.g. the opposite of what it returns now). To maintain the current behavior, use `saved_change_to_attribute?` instead. (called from save at /home/vagrant/foreman/app/models/concerns/foreman/sti.rb:26) 2018-05-28T14:00:03 [W|app|49c53] DEPRECATION WARNING: The behavior of `attribute_changed?` inside of after callbacks will be changing in the next version of Rails. The new return value will reflect the behavior of calling the method after `save` returned (e.g. the opposite of what it returns now). To maintain the current behavior, use `saved_change_to_attribute?` instead. (called from save at /home/vagrant/foreman/app/models/concerns/foreman/sti.rb:26) 2018-05-28T14:00:03 [W|app|49c53] DEPRECATION WARNING: The behavior of `changed` inside of after callbacks will be changing in the next version of Rails. The new return value will reflect the behavior of calling the method after `save` returned (e.g. the opposite of what it returns now). To maintain the current behavior, use `saved_changes.keys` instead. (called from update_scap_client at /home/vagrant/foreman_openscap/app/models/concerns/foreman_openscap/openscap_proxy_core_extensions.rb:12) 2018-05-28T14:00:03 [W|app|49c53] DEPRECATION WARNING: The behavior of `changed_attributes` inside of after callbacks will be changing in the next version of Rails. The new return value will reflect the behavior of calling the method after `save` returned (e.g. the opposite of what it returns now). To maintain the current behavior, use `saved_changes.transform_values(&:first)` instead. (called from update_scap_client at /home/vagrant/foreman_openscap/app/models/concerns/foreman_openscap/openscap_proxy_core_extensions.rb:12) 2018-05-28T14:00:03 [W|app|49c53] Action failed | ActiveRecord::RecordInvalid: Validation failed: Major version is not a number, Major version Operating System version is required, Name can't be blank, Title can't be blank | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/activerecord-5.1.4/lib/active_record/validations.rb:78:in `raise_validation_error' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/activerecord-5.1.4/lib/active_record/validations.rb:50:in `save!' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/activerecord-5.1.4/lib/active_record/attribute_methods/dirty.rb:43:in `save!' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/activerecord-5.1.4/lib/active_record/transactions.rb:313:in `block in save!' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/activerecord-5.1.4/lib/active_record/transactions.rb:384:in `block in with_transaction_returning_status' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/database_statements.rb:235:in `block in transaction' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/transaction.rb:194:in `block in within_new_transaction' | /home/vagrant/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/transaction.rb:191:in `within_new_transaction' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/database_statements.rb:235:in `transaction' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/activerecord-5.1.4/lib/active_record/transactions.rb:210:in `transaction' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/activerecord-5.1.4/lib/active_record/transactions.rb:381:in `with_transaction_returning_status' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/activerecord-5.1.4/lib/active_record/transactions.rb:313:in `save!' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/activerecord-5.1.4/lib/active_record/suppressor.rb:46:in `save!' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/activerecord-5.1.4/lib/active_record/persistence.rb:51:in `create!' | /home/vagrant/foreman_ansible/app/services/foreman_ansible/fact_parser.rb:14:in `operatingsystem' | /home/vagrant/foreman/app/models/host/base.rb:188:in `block in set_non_empty_values' | /home/vagrant/foreman/app/models/host/base.rb:187:in `each' | /home/vagrant/foreman/app/models/host/base.rb:187:in `set_non_empty_values' | /home/vagrant/foreman/app/models/host/base.rb:182:in `populate_fields_from_facts' | /home/vagrant/foreman/app/models/host/managed.rb:414:in `populate_fields_from_facts' | /home/vagrant/foreman/app/models/concerns/puppet_host_extensions.rb:3:in `populate_fields_from_facts' | /home/vagrant/foreman/app/models/host/base.rb:161:in `block in parse_facts' | /home/vagrant/foreman/app/services/foreman/telemetry_helper.rb:27:in `telemetry_duration_histogram' | /home/vagrant/foreman/app/models/host/base.rb:160:in `parse_facts' | /home/vagrant/foreman/app/models/host/base.rb:149:in `import_facts' | /home/vagrant/foreman/app/models/host/managed.rb:336:in `import_facts' | /home/vagrant/foreman/app/controllers/api/v2/hosts_controller.rb:287:in `facts' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.4/lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.4/lib/abstract_controller/base.rb:186:in `process_action' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.4/lib/action_controller/metal/rendering.rb:30:in `process_action' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.4/lib/abstract_controller/callbacks.rb:20:in `block in process_action' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:108:in `block in run_callbacks' | /home/vagrant/foreman/app/controllers/api/v2/base_controller.rb:163:in `disable_json_root' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:117:in `block in run_callbacks' | /home/vagrant/foreman/app/controllers/concerns/application_shared.rb:15:in `set_timezone' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:117:in `block in run_callbacks' | /home/vagrant/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:117:in `block in run_callbacks' | /home/vagrant/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:117:in `block in run_callbacks' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/audited-4.7.1/lib/audited/sweeper.rb:14:in `around' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:117:in `block in run_callbacks' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/audited-4.7.1/lib/audited/sweeper.rb:14:in `around' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:117:in `block in run_callbacks' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:135:in `run_callbacks' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.4/lib/abstract_controller/callbacks.rb:19:in `process_action' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.4/lib/action_controller/metal/rescue.rb:20:in `process_action' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.4/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/activesupport-5.1.4/lib/active_support/notifications.rb:166:in `block in instrument' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/activesupport-5.1.4/lib/active_support/notifications/instrumenter.rb:21:in `instrument' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/activesupport-5.1.4/lib/active_support/notifications.rb:166:in `instrument' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.4/lib/action_controller/metal/instrumentation.rb:30:in `process_action' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.4/lib/action_controller/metal/params_wrapper.rb:252:in `process_action' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/activerecord-5.1.4/lib/active_record/railties/controller_runtime.rb:22:in `process_action' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.4/lib/abstract_controller/base.rb:124:in `process' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/actionview-5.1.4/lib/action_view/rendering.rb:30:in `process' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.4/lib/action_controller/metal.rb:189:in `dispatch' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.4/lib/action_controller/metal.rb:253:in `dispatch' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb:49:in `dispatch' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb:31:in `serve' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/mapper.rb:16:in `block in <class:Constraints>' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/mapper.rb:46:in `serve' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/journey/router.rb:50:in `block in serve' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/journey/router.rb:33:in `each' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/journey/router.rb:33:in `serve' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb:834:in `call' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/static.rb:125:in `call' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/static.rb:125:in `call' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/apipie-rails-0.5.8/lib/apipie/static_dispatcher.rb:65:in `call' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/apipie-rails-0.5.8/lib/apipie/extractor/recorder.rb:136:in `call' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/static.rb:125:in `call' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/static.rb:125:in `call' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/static.rb:125:in `call' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/static.rb:125:in `call' | /home/vagrant/foreman/lib/middleware/telemetry.rb:13:in `call' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/apipie-rails-0.5.8/lib/apipie/middleware/checksum_in_headers.rb:27:in `call' | /home/vagrant/foreman/lib/middleware/catch_json_parse_errors.rb:8:in `call' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/rack-openid-1.4.2/lib/rack/openid.rb:98:in `call' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/rack-2.0.5/lib/rack/etag.rb:25:in `call' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/rack-2.0.5/lib/rack/conditional_get.rb:38:in `call' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/rack-2.0.5/lib/rack/head.rb:12:in `call' | /home/vagrant/foreman/lib/middleware/logging_context.rb:23:in `call' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/rack-2.0.5/lib/rack/session/abstract/id.rb:232:in `context' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/rack-2.0.5/lib/rack/session/abstract/id.rb:226:in `call' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/cookies.rb:613:in `call' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:556:in `call' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/callbacks.rb:26:in `block in call' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:97:in `run_callbacks' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/callbacks.rb:24:in `call' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/executor.rb:12:in `call' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/better_errors-2.4.0/lib/better_errors/middleware.rb:84:in `protected_app_call' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/better_errors-2.4.0/lib/better_errors/middleware.rb:79:in `better_errors_call' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/better_errors-2.4.0/lib/better_errors/middleware.rb:57:in `call' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/debug_exceptions.rb:59:in `call' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/show_exceptions.rb:31:in `call' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/railties-5.1.4/lib/rails/rack/logger.rb:36:in `call_app' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/railties-5.1.4/lib/rails/rack/logger.rb:26:in `call' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/quiet_assets.rb:13:in `call' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/remote_ip.rb:79:in `call' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/request_id.rb:25:in `call' | /home/vagrant/katello/lib/katello/prevent_json_parsing.rb:12:in `call' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/rack-2.0.5/lib/rack/method_override.rb:22:in `call' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/rack-2.0.5/lib/rack/runtime.rb:22:in `call' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/activesupport-5.1.4/lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/executor.rb:12:in `call' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/static.rb:125:in `call' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/rack-2.0.5/lib/rack/sendfile.rb:111:in `call' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/secure_headers-5.0.5/lib/secure_headers/middleware.rb:13:in `call' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/railties-5.1.4/lib/rails/engine.rb:522:in `call' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/railties-5.1.4/lib/rails/railtie.rb:185:in `public_send' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/railties-5.1.4/lib/rails/railtie.rb:185:in `method_missing' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/rack-2.0.5/lib/rack/urlmap.rb:68:in `block in call' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/rack-2.0.5/lib/rack/urlmap.rb:53:in `each' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/rack-2.0.5/lib/rack/urlmap.rb:53:in `call' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/puma-3.11.4/lib/puma/configuration.rb:225:in `call' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/puma-3.11.4/lib/puma/server.rb:632:in `handle_request' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/puma-3.11.4/lib/puma/server.rb:446:in `process_client' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/puma-3.11.4/lib/puma/server.rb:306:in `block in run' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/puma-3.11.4/lib/puma/thread_pool.rb:120:in `block in spawn_thread' | /home/vagrant/.rvm/gems/ruby-2.4.0/gems/logging-2.2.2/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context' 2018-05-28T14:00:03 [I|app|49c53] Rendering api/v2/errors/standard_error.json.rabl within api/v2/layouts/error_layout 2018-05-28T14:00:03 [I|app|49c53] Rendered api/v2/errors/standard_error.json.rabl within api/v2/layouts/error_layout (1.2ms) 2018-05-28T14:00:03 [I|app|49c53] Completed 500 Internal Server Error in 97ms (Views: 4.8ms | ActiveRecord: 25.6ms)
Actions