Bug #31364
undefined method `without_orchestration'
Description
I'm not really well versed in Foreman, so, if I need to provide more detail, happy to do so, but I may need guidance.
I upgraded from 2.1 to 2.2 a couple of weeks ago. CPU usage is WAY higher for me, between ruby and postgres, to the point that I had to go from 2 to 4 CPUs on the CentOS7 VM running foreman. I didn't have time to dig into why.
I don't do any provisioning from foreman. All I use it for is to collect reports/facts from puppet. It's been running and seems okay, but that extra CPU made me wonder, so I finally looked.
production.log is getting spammed with tracebacks:
2020-11-21T22:36:30 [I|app|7b7cb68d] Started POST "/api/hosts/facts" for 10.58.75.23 at 2020-11-21 22:36:30 +0000 2020-11-21T22:36:30 [I|app|7b7cb68d] Processing by Api::V2::HostsController#facts as JSON 2020-11-21T22:36:30 [I|app|7b7cb68d] Parameters: {"facts"=>"[FILTERED]", "name"=>"REDACTEDHOSTNAME", "certname"=>"REDACTEDHOSTNAME", "apiv"=>"v2", "host"=>{"certname"=>"REDACTEDHOSTNAME", "name"=>"REDACTEDHOSTNAME"}} 2020-11-21T22:36:31 [I|app|7b7cb68d] Import facts for 'REDACTEDHOSTNAME' completed. Added: 5, Updated: 20, Deleted 0 facts 2020-11-21T22:36:31 [W|app|7b7cb68d] Action failed 2020-11-21T22:36:31 [I|app|7b7cb68d] Backtrace for 'Action failed' error (NoMethodError): undefined method `without_orchestration' for #<Host::Managed:0x00007f4834768a80> 7b7cb68d | Did you mean? without_auditing 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/activemodel-6.0.3.1/lib/active_model/attribute_methods.rb:432:in `method_missing' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/audited-4.9.0/lib/audited/auditor.rb:99:in `method_missing' 7b7cb68d | /usr/share/foreman/app/services/host_fact_importer.rb:47:in `skipping_orchestration' 7b7cb68d | /usr/share/foreman/app/services/host_fact_importer.rb:30:in `import_facts' 7b7cb68d | /usr/share/foreman/app/controllers/api/v2/hosts_controller.rb:306:in `facts' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/abstract_controller/base.rb:195:in `process_action' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_controller/metal/rendering.rb:30:in `process_action' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/abstract_controller/callbacks.rb:42:in `block in process_action' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:112:in `block in run_callbacks' 7b7cb68d | /usr/share/foreman/app/controllers/api/v2/base_controller.rb:181:in `disable_json_root' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:121:in `block in run_callbacks' 7b7cb68d | /usr/share/foreman/app/controllers/concerns/foreman/controller/timezone.rb:10:in `set_timezone' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:121:in `block in run_callbacks' 7b7cb68d | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:121:in `block in run_callbacks' 7b7cb68d | /usr/share/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:121:in `block in run_callbacks' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/audited-4.9.0/lib/audited/sweeper.rb:14:in `around' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:121:in `block in run_callbacks' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/audited-4.9.0/lib/audited/sweeper.rb:14:in `around' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:121:in `block in run_callbacks' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:139:in `run_callbacks' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/abstract_controller/callbacks.rb:41:in `process_action' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_controller/metal/rescue.rb:22:in `process_action' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_controller/metal/instrumentation.rb:33:in `block in process_action' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/notifications.rb:180:in `block in instrument' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/notifications/instrumenter.rb:24:in `instrument' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/notifications.rb:180:in `instrument' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_controller/metal/instrumentation.rb:32:in `process_action' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_controller/metal/params_wrapper.rb:245:in `process_action' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.1/lib/active_record/railties/controller_runtime.rb:27:in `process_action' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/abstract_controller/base.rb:136:in `process' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/actionview-6.0.3.1/lib/action_view/rendering.rb:39:in `process' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_controller/metal.rb:190:in `dispatch' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_controller/metal.rb:254:in `dispatch' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_dispatch/routing/route_set.rb:50:in `dispatch' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_dispatch/routing/route_set.rb:33:in `serve' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_dispatch/routing/mapper.rb:18:in `block in <class:Constraints>' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_dispatch/routing/mapper.rb:48:in `serve' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_dispatch/journey/router.rb:49:in `block in serve' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_dispatch/journey/router.rb:32:in `each' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_dispatch/journey/router.rb:32:in `serve' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_dispatch/routing/route_set.rb:834:in `call' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-dsl-2.2.9/lib/apipie_dsl/static_dispatcher.rb:67:in `call' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.17/lib/apipie/static_dispatcher.rb:66:in `call' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.17/lib/apipie/extractor/recorder.rb:137:in `call' 7b7cb68d | /usr/share/foreman/lib/foreman/middleware/telemetry.rb:10:in `call' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.17/lib/apipie/middleware/checksum_in_headers.rb:27:in `call' 7b7cb68d | /usr/share/foreman/lib/foreman/middleware/catch_json_parse_errors.rb:9:in `call' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/tempfile_reaper.rb:15:in `call' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/etag.rb:27:in `call' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/conditional_get.rb:40:in `call' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/head.rb:12:in `call' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_dispatch/http/content_security_policy.rb:18:in `call' 7b7cb68d | /usr/share/foreman/lib/foreman/middleware/logging_context_session.rb:22:in `call' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/session/abstract/id.rb:266:in `context' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/session/abstract/id.rb:260:in `call' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_dispatch/middleware/cookies.rb:648:in `call' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:101:in `run_callbacks' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_dispatch/middleware/callbacks.rb:26:in `call' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_dispatch/middleware/actionable_exceptions.rb:17:in `call' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_dispatch/middleware/debug_exceptions.rb:32:in `call' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/railties-6.0.3.1/lib/rails/rack/logger.rb:37:in `call_app' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/railties-6.0.3.1/lib/rails/rack/logger.rb:28:in `call' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/sprockets-rails-3.2.1/lib/sprockets/rails/quiet_assets.rb:13:in `call' 7b7cb68d | /usr/share/foreman/lib/foreman/middleware/logging_context_request.rb:11:in `call' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_dispatch/middleware/remote_ip.rb:81:in `call' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_dispatch/middleware/request_id.rb:27:in `call' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/method_override.rb:24:in `call' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/runtime.rb:22:in `call' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_dispatch/middleware/executor.rb:14:in `call' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_dispatch/middleware/static.rb:126:in `call' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/sendfile.rb:110:in `call' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/action_dispatch/middleware/host_authorization.rb:76:in `call' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/secure_headers-6.3.0/lib/secure_headers/middleware.rb:11:in `call' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/railties-6.0.3.1/lib/rails/engine.rb:527:in `call' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/railties-6.0.3.1/lib/rails/railtie.rb:190:in `public_send' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/railties-6.0.3.1/lib/rails/railtie.rb:190:in `method_missing' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/urlmap.rb:74:in `block in call' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/urlmap.rb:58:in `each' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/urlmap.rb:58:in `call' 7b7cb68d | /usr/share/passenger/phusion_passenger/rack/thread_handler_extension.rb:74:in `process_request' 7b7cb68d | /usr/share/passenger/phusion_passenger/request_handler/thread_handler.rb:141:in `accept_and_process_next_request' 7b7cb68d | /usr/share/passenger/phusion_passenger/request_handler/thread_handler.rb:109:in `main_loop' 7b7cb68d | /usr/share/passenger/phusion_passenger/request_handler.rb:455:in `block (3 levels) in start_threads' 7b7cb68d | /opt/theforeman/tfm/root/usr/share/gems/gems/logging-2.2.2/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context' 2020-11-21T22:36:31 [I|app|7b7cb68d] Rendering api/v2/errors/custom_error.json.rabl within api/v2/layouts/error_layout 2020-11-21T22:36:31 [I|app|7b7cb68d] Rendered api/v2/errors/custom_error.json.rabl within api/v2/layouts/error_layout (Duration: 0.2ms | Allocations: 67) 2020-11-21T22:36:31 [I|app|7b7cb68d] Completed 500 Internal Server Error in 892ms (Views: 0.8ms | ActiveRecord: 232.9ms | Allocations: 253798)
From what I see, commits 5253d21ed7d690e80e595a075d06f96d2e211e8c and 6caa9ffdba581b798bad3b89bc0f6f60621f12d7 on https://github.com/theforeman/foreman introduced 'without_orchestration', between 2.1.4 and 2.2.0, but I feel like something got missed here, and I'm not sure what.
My puppetservers are using https://github.com/theforeman/puppet-foreman version 16.0.0 and its foreman::puppetmaster class to config up reports/facts... so I don't think I'm doing anything weird or special here. "It just worked before the upgrade."
Related issues
Associated revisions
History
#1
Updated by Tomer Brisker over 2 years ago
- Related to Refactor #30127: Extract import_facts entry point from host class and create HostFactImporter added
#2
Updated by Tomer Brisker over 2 years ago
By any chance do you have `:unattended: false` configured in your /etc/foreman/settings.yaml file?
#3
Updated by Tomer Brisker over 2 years ago
- Target version set to 2.2.2
#4
Updated by The Foreman Bot over 2 years ago
- Assignee set to Tomer Brisker
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/8160 added
#5
Updated by The Foreman Bot over 2 years ago
- Pull request https://github.com/theforeman/foreman/pull/8161 added
#6
Updated by Greg C over 2 years ago
Tomer Brisker wrote:
By any chance do you have `:unattended: false` configured in your /etc/foreman/settings.yaml file?
Correct. Very first setting,
:unattended: false
We don't provision with our foreman, we just capture puppet data for pretty pictures.
#7
Updated by The Foreman Bot over 2 years ago
- Fixed in Releases 2.4.0 added
#8
Updated by Tomer Brisker over 2 years ago
- Status changed from Ready For Testing to Closed
Applied in changeset foreman|208313190271a66f4f7a4df5fb2b584774a370c7.
#9
Updated by Tomer Brisker over 2 years ago
- Fixed in Releases 2.2.2, 2.3.0 added
- Fixed in Releases deleted (
2.4.0)
#10
Updated by Tomer Brisker over 2 years ago
Thanks for reporting Greg! The fix will be included in 2.2.2 and 2.3.0, but until they are released you can apply the patch from https://github.com/theforeman/foreman/commit/59fcc62528058091df7290b13f7d35f10a40f051.diff manually and restart your foreman to fix the issue.
Fixes #31364 - Properly import facts when unattended false
The fact importer calls host.without_orchestration which is defined in
orchestration concern, however the concern is only included when
unattended true. Users who have the setting set to false will not be
able to import facts as the fact importer will fail to find this method.