Project

General

Profile

Actions

Bug #37939

open

Search Bar offers to filter by 'locked_*' but API fails to search by these values

Added by Markus Bucher 7 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Foreman plugin
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

Typing 'locked_' into Tasks-Index page's search-bar offers among others locked_resource_id and locked_resource_type.

Trying to do so however fails with 500:

2024-10-22T13:57:36 [I|app|199920c6] Started GET "/foreman_tasks/api/tasks?search=%28locked_resource_type+%3D+Katello%3A%3ARepository%29&page=1&include_permissions=true" for 192.168.121.1 at 2024-10-22 13:57:36 +0000
2024-10-22T13:57:37 [I|app|199920c6] Processing by ForemanTasks::Api::TasksController#index as JSON
2024-10-22T13:57:37 [I|app|199920c6]   Parameters: {"search"=>"(locked_resource_type = Katello::Repository)", "page"=>"1", "include_permissions"=>"true"}
2024-10-22T13:57:37 [D|app|199920c6]   Rendering layout api/v2/layouts/index_layout.json.erb
2024-10-22T13:57:37 [D|app|199920c6]   Rendering .vendor/ruby/3.0.0/gems/foreman-tasks-10.0.0/app/views/foreman_tasks/api/tasks/index.json.rabl within api/v2/layouts/index_layout
2024-10-22T13:57:37 [I|app|199920c6]   Rendered .vendor/ruby/3.0.0/gems/foreman-tasks-10.0.0/app/views/foreman_tasks/api/tasks/index.json.rabl within api/v2/layouts/index_layout (Duration: 4.0ms | Allocations: 1210)
2024-10-22T13:57:37 [I|app|199920c6]   Rendered layout api/v2/layouts/index_layout.json.erb (Duration: 4.4ms | Allocations: 1352)
2024-10-22T13:57:37 [W|app|199920c6] Action failed
2024-10-22T13:57:37 [I|app|199920c6] Backtrace for 'Action failed' error (ActionView::Template::Error): PG::UndefinedColumn: ERROR:  column foreman_tasks_links.locked_resource_type does not exist
 199920c6 | LINE 5: ...ks_links_taxonomy434ddc.resource_id IS NULL) AND (foreman_ta...
 199920c6 |                                                              ^
 199920c6 | 
 199920c6 | /home/vagrant/foreman/.vendor/ruby/3.0.0/gems/activerecord-6.1.7.9/lib/active_record/connection_adapters/postgresql_adapter.rb:672:in `exec_params'

Either fix searching for locked resources (which I would prefer, because it can be useful) or /foreman_tasks/tasks/auto_complete_search should not offer these search-parameters.

No data to display

Actions

Also available in: Atom PDF