Project

General

Profile

Actions

Bug #35591

closed

Can't use 'search' with fact_value via API

Added by Adam Winberg over 1 year ago. Updated about 1 year ago.

Status:
Duplicate
Priority:
Normal
Assignee:
-
Category:
API
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

Trying to get a fact value via API fails with:

https://<foremanhost>/api/fact_values/?search=name=myfact+and+host=lxserv1638
{
  "error": {"message":"Internal Server Error: the server was unable to finish the request. This may be caused by unavailability of some required service, incorrect API call or a server-side bug. There may be more information in the server's logs."}
}

production.log on Foreman server:

2022-10-04T07:54:50 [I|app|4a5a7802] Started GET "/api/fact_values/?search=name=myfact+and+host=lxserv1638" for 10.65.1.80 at 2022-10-04 07:54:50 +0000
2022-10-04T07:54:50 [I|app|4a5a7802] Processing by Api::V2::FactValuesController#index as JSON
2022-10-04T07:54:50 [I|app|4a5a7802]   Parameters: {"search"=>"name=myfact and host=lxserv1638", "apiv"=>"v2"}
2022-10-04T07:54:50 [I|app|4a5a7802] Authorized user foremanread(foremanread)
2022-10-04T07:54:51 [W|app|4a5a7802] Action failed
2022-10-04T07:54:51 [I|app|4a5a7802] Backtrace for 'Action failed' error (ActiveModel::MissingAttributeError): missing attribute: fact_name_id
 4a5a7802 | /usr/share/gems/gems/activemodel-6.1.6.1/lib/active_model/attribute.rb:222:in `value'
 4a5a7802 | /usr/share/gems/gems/activemodel-6.1.6.1/lib/active_model/attribute_set/builder.rb:55:in `block in fetch_value'
 4a5a7802 | /usr/share/gems/gems/activemodel-6.1.6.1/lib/active_model/attribute_set/builder.rb:46:in `fetch'
...

If I turn on sql debugging and run the sql query written to the logs I get a correct response.
If I impersonate the user used to do the API request and do the same fact search in the GUI I get the correct response.

This has worked before, but not sure when it stopped working.


Related issues 3 (1 open2 closed)

Related to Foreman - Bug #31897: Headline api feature per_page=all doesn't work for all resourcesNewActions
Related to Foreman - Refactor #34160: Improve the fact_values api performance when loading a large number of factsClosedTomer BriskerActions
Is duplicate of Foreman - Bug #35990: Parameter 'search' on fact_value API endpoint results in internal server errorClosedNofar AlfassiActions
Actions #1

Updated by Adam Winberg over 1 year ago

This worked on 3.1 - not sure though if it stopped working on 3.2, 3.3 or 3.4.

Actions #2

Updated by Adam Winberg over 1 year ago

The user in question has one role, the OOTB 'Viewer' role.

Actions #3

Updated by Adam Winberg over 1 year ago

  • Description updated (diff)

It seems to be the search query that causes the problem, I can run

https://<foremanhost>/api/fact_values/

just fine, and it lists the facts I want. But as soon as I introduce any search parameters in the query I get the backtrace mentioned.

Actions #4

Updated by Adam Winberg over 1 year ago

Further findings: adding '&per_page=all' to the url makes the backtrace go away, but the result is empty:

{
  "total": 0,
  "subtotal": 0,
  "page": 1,
  "per_page": 0,
  "search": "name = myfact",
  "sort": {
    "by": null,
    "order": null
  },
  "results": {}
}

The same query with the same user in the GUI yields the correct result.

Actions #5

Updated by Adam Winberg over 1 year ago

hmm, 'per_page=all' does not seem to work at all - I can input any string I want there and still get the same result:

"per_page": 0,

I guess this bug is relevant:
https://projects.theforeman.org/issues/31897

Setting a valid integer as value ('per_page=1000') results in backtrace and error.

Actions #6

Updated by Adam Winberg over 1 year ago

  • Subject changed from Can't get fact value via API to Can't use 'search' with fact_value via API
Actions #7

Updated by Ewoud Kohl van Wijngaarden over 1 year ago

  • Related to Bug #31897: Headline api feature per_page=all doesn't work for all resources added
Actions #8

Updated by Ewoud Kohl van Wijngaarden over 1 year ago

The only difference on the controller is 21fefa341f59fb2af63494aab5133e99d6a7e98b (see

git log 3.1.0..HEAD ./app/controllers/api/v2/fact_values_controller.rb
) so that's the likely culprit. It was introduced in 3.2.0. The join on `fact_name` looks like it may trigger fact_name_id.

Though it is odd that it only fails on search.

Is there more to the backtrace? This now only points to Rails code but I wonder where in the Foreman code it triggers.

Actions #9

Updated by Benjamin Rechsteiner over 1 year ago

this is the entire backtrace from my logfile:

2022-11-29T23:26:39 [I|app|be03cffc] Backtrace for 'Action failed' error (ActiveModel::MissingAttributeError): missing attribute: fact_name_id
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/activemodel-6.1.6.1/lib/active_model/attribute.rb:222:in `value'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/activemodel-6.1.6.1/lib/active_model/attribute_set/builder.rb:55:in `block in fetch_value'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/activemodel-6.1.6.1/lib/active_model/attribute_set/builder.rb:46:in `fetch'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/activemodel-6.1.6.1/lib/active_model/attribute_set/builder.rb:46:in `fetch_value'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/attribute_methods/read.rb:36:in `_read_attribute'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/associations/belongs_to_association.rb:132:in `stale_state'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/associations/association.rb:79:in `loaded!'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/associations/association.rb:96:in `target='
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/associations/join_dependency.rb:284:in `construct_model'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/associations/join_dependency.rb:264:in `block in construct'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/associations/join_dependency.rb:241:in `each'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/associations/join_dependency.rb:241:in `construct'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/associations/join_dependency.rb:142:in `block (2 levels) in instantiate'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/result.rb:62:in `block in each'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/result.rb:62:in `each'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/result.rb:62:in `each'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/associations/join_dependency.rb:139:in `block in instantiate'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/associations/join_dependency.rb:138:in `instantiate'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/relation.rb:839:in `block (2 levels) in exec_queries'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/relation/finder_methods.rb:421:in `apply_join_dependency'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/relation.rb:833:in `block in exec_queries'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/relation.rb:861:in `skip_query_cache_if_necessary'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/relation.rb:828:in `exec_queries'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/relation.rb:631:in `load'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/relation.rb:249:in `records'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/relation/delegation.rb:88:in `each'
 be03cffc | /usr/share/foreman/app/controllers/api/v2/fact_values_controller.rb:32:in `build_facts_hash'
 be03cffc | /usr/share/foreman/app/controllers/api/v2/fact_values_controller.rb:20:in `index'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/abstract_controller/base.rb:228:in `process_action'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_controller/metal/rendering.rb:30:in `process_action'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 be03cffc | /usr/share/foreman/app/controllers/concerns/foreman/controller/timezone.rb:10:in `set_timezone'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 be03cffc | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 be03cffc | /usr/share/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/audited-4.10.0/lib/audited/sweeper.rb:14:in `around'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/audited-4.10.0/lib/audited/sweeper.rb:14:in `around'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:137:in `run_callbacks'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/abstract_controller/callbacks.rb:41:in `process_action'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_controller/metal/rescue.rb:22:in `process_action'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/notifications.rb:203:in `block in instrument'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/notifications.rb:203:in `instrument'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_controller/metal/instrumentation.rb:33:in `process_action'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_controller/metal/params_wrapper.rb:249:in `process_action'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/railties/controller_runtime.rb:27:in `process_action'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/abstract_controller/base.rb:165:in `process'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionview-6.1.6.1/lib/action_view/rendering.rb:39:in `process'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_controller/metal.rb:190:in `dispatch'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_controller/metal.rb:254:in `dispatch'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_dispatch/routing/route_set.rb:33:in `serve'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_dispatch/routing/mapper.rb:19:in `block in <class:Constraints>'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_dispatch/routing/mapper.rb:49:in `serve'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_dispatch/journey/router.rb:50:in `block in serve'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_dispatch/journey/router.rb:32:in `each'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_dispatch/journey/router.rb:32:in `serve'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_dispatch/routing/route_set.rb:842:in `call'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/apipie-dsl-2.5.0/lib/apipie_dsl/static_dispatcher.rb:67:in `call'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/apipie-rails-0.5.20/lib/apipie/static_dispatcher.rb:66:in `call'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/apipie-rails-0.5.20/lib/apipie/extractor/recorder.rb:137:in `call'
 be03cffc | /usr/share/foreman/lib/foreman/middleware/libvirt_connection_cleaner.rb:9:in `call'
 be03cffc | /usr/share/foreman/lib/foreman/middleware/telemetry.rb:10:in `call'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/apipie-rails-0.5.20/lib/apipie/middleware/checksum_in_headers.rb:27:in `call'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/rack-2.2.4/lib/rack/tempfile_reaper.rb:15:in `call'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/rack-2.2.4/lib/rack/etag.rb:27:in `call'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/rack-2.2.4/lib/rack/conditional_get.rb:27:in `call'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/rack-2.2.4/lib/rack/head.rb:12:in `call'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_dispatch/http/permissions_policy.rb:22:in `call'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_dispatch/http/content_security_policy.rb:19:in `call'
 be03cffc | /usr/share/foreman/lib/foreman/middleware/logging_context_session.rb:22:in `call'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/rack-2.2.4/lib/rack/session/abstract/id.rb:266:in `context'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/rack-2.2.4/lib/rack/session/abstract/id.rb:260:in `call'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/cookies.rb:689:in `call'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:98:in `run_callbacks'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/debug_exceptions.rb:29:in `call'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/rack/logger.rb:37:in `call_app'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/rack/logger.rb:28:in `call'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/sprockets-rails-3.4.2/lib/sprockets/rails/quiet_assets.rb:13:in `call'
 be03cffc | /usr/share/foreman/lib/foreman/middleware/logging_context_request.rb:11:in `call'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/request_id.rb:26:in `call'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/rack-2.2.4/lib/rack/method_override.rb:24:in `call'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/rack-2.2.4/lib/rack/runtime.rb:22:in `call'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/executor.rb:14:in `call'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/static.rb:24:in `call'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/rack-2.2.4/lib/rack/sendfile.rb:110:in `call'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/ssl.rb:77:in `call'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/host_authorization.rb:142:in `call'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/secure_headers-6.4.0/lib/secure_headers/middleware.rb:11:in `call'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/engine.rb:539:in `call'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/railtie.rb:207:in `public_send'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/railtie.rb:207:in `method_missing'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/rack-2.2.4/lib/rack/urlmap.rb:74:in `block in call'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/rack-2.2.4/lib/rack/urlmap.rb:58:in `each'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/rack-2.2.4/lib/rack/urlmap.rb:58:in `call'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/puma-5.6.5/lib/puma/configuration.rb:252:in `call'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/puma-5.6.5/lib/puma/request.rb:77:in `block in handle_request'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/puma-5.6.5/lib/puma/thread_pool.rb:340:in `with_force_shutdown'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/puma-5.6.5/lib/puma/request.rb:76:in `handle_request'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/puma-5.6.5/lib/puma/server.rb:443:in `process_client'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/puma-5.6.5/lib/puma/thread_pool.rb:147:in `block in spawn_thread'
 be03cffc | /usr/share/foreman/vendor/ruby/2.7.0/gems/logging-2.3.1/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
Actions #10

Updated by Ewoud Kohl van Wijngaarden over 1 year ago

  • Related to Refactor #34160: Improve the fact_values api performance when loading a large number of facts added
Actions #11

Updated by Ewoud Kohl van Wijngaarden over 1 year ago

Ok, that confirms to me that #34160 introduced the regression since build_facts_hash was only introduced in that commit and there have been no changes to that file since.

Actions #12

Updated by Benjamin Rechsteiner over 1 year ago

@Ewoud: Is there a possibility that this problem will be fixed in a timely manner or is it possible to roll back the change that caused the problem?

Actions #13

Updated by Luis Pigueiras over 1 year ago

Hello, it's also happening to us. Reverting back the changes on top of 3.5.1 from https://projects.theforeman.org/projects/foreman/repository/revisions/21fefa341f59fb2af63494aab5133e99d6a7e98b seems to restore the functionality. Could this be reverted for 3.5.2 at least?

Actions #14

Updated by The Foreman Bot over 1 year ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/9602 added
Actions #15

Updated by Nofar Alfassi over 1 year ago

  • Status changed from Ready For Testing to Duplicate
Actions #16

Updated by Ewoud Kohl van Wijngaarden over 1 year ago

  • Is duplicate of Bug #35990: Parameter 'search' on fact_value API endpoint results in internal server error added
Actions #17

Updated by Benjamin Rechsteiner about 1 year ago

Workaround: replace line 18 in /usr/share/foreman/app/controllers/api/v2/fact_values_controller.rb with:

select(:fact_name_id, :value, 'fact_names.name as factname', 'hosts.name as hostname', 'hosts.id as host_id')

Actions

Also available in: Atom PDF