Description of problem: # curl -K /opt/hoici/etc/sat6/curl-hoici.conf "-HContent-Type: application/json" "-d{\"per_page\":9999,\"organization_id\":3}" -XGET https://localhost/katello/api/v2/content_view_filters/17/rules {"displayMessage":"Unable to order by column 'name_sort'.","errors":["Unable to order by column 'name_sort'."]} Traces from Logs: 2015-07-13 13:46:17 [I] Processing by Katello::Api::V2::ContentViewFilterRulesController#index as */* 2015-07-13 13:46:17 [I] Parameters: {"per_page"=>9999, "api_version"=>"v2", "content_view_filter_id"=>"18", "content_view_filter_rule"=>{"per_page"=>9999}} 2015-07-13 13:46:17 [I] Authorized user hoici(hoici ) 2015-07-13 13:46:17 [E] RuntimeError: Unable to order by column 'name_sort'. /opt/rh/ruby193/root/usr/share/gems/gems/katello-2.2.0.51/app/models/katello/glue/elastic_search/items.rb:129:in `handle_search_request_fail' /opt/rh/ruby193/root/usr/share/gems/gems/katello-2.2.0.51/app/models/katello/glue/elastic_search/items.rb:124:in `rescue in retrieve' /opt/rh/ruby193/root/usr/share/gems/gems/katello-2.2.0.51/app/models/katello/glue/elastic_search/items.rb:52:in `retrieve' /opt/rh/ruby193/root/usr/share/gems/gems/katello-2.2.0.51/app/controllers/katello/api/v2/api_controller.rb:77:in `item_search' /opt/rh/ruby193/root/usr/share/gems/gems/katello-2.2.0.51/app/controllers/katello/api/v2/content_view_filter_rules_controller.rb:26:in `index' /opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_controller/metal/implicit_render.rb:4:in `send_action' /opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/abstract_controller/base.rb:167:in `process_action' /opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_controller/metal/rendering.rb:10:in `process_action' /opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/abstract_controller/callbacks.rb:18:in `block in process_action' /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:528:in `block (4 levels) in _run__2536660760801069728__process_action__10151642543491308 72__callbacks' /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:215:in `block in _conditional_callback_around_11549' /usr/share/foreman/app/controllers/api/v2/base_controller.rb:151:in `disable_json_root' ... /usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/lib/phusion_passenger/request_handler/thread_handler.rb:140:in `accept_and_process_next_request' /usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/lib/phusion_passenger/request_handler/thread_handler.rb:108:in `main_loop' /usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/lib/phusion_passenger/request_handler.rb:441:in `block (3 levels) in start_threads' /opt/rh/ruby193/root/usr/share/gems/gems/logging-1.8.1/lib/logging/diagnostic_context.rb:323:in `call' /opt/rh/ruby193/root/usr/share/gems/gems/logging-1.8.1/lib/logging/diagnostic_context.rb:323:in `block in create_with_logging_context' caused by: (Tire::Search::SearchRequestFailed) 400 : {"error":"SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; shardFailures {[sZsR1HcsSOu_0MFgsdIo5A][katello_katello::contentviewerratumfilterrule][0]: SearchParseException[[katello_katello::contentviewerratumfilterrule][0]: query[ConstantScore(*:*)],from[-1],size[-1]: Parse Failure [Failed to parse source [{\"query\":{\"match_all\":{}},\"sort\":[{\"name_sort\":\"asc\"}],\"filter\":{\"and\":[{\"terms\":{\"id\":[]}}]},\"size\":9999,\"from\":0,\"fields\":[\"id\"]}]]]; nested: SearchParseException[[katello_katello::contentviewerratumfilterrule][0]: query[ConstantScore(*:*)],from[-1],size[-1]: Parse Failure [No mapping found for [name_sort] in order to sort on]]; }{[sZsR1HcsSOu_0MFgsdIo5A][katello_katello::contentviewerratumfilterrule][1]: SearchParseException[[katello_katello::contentviewerratumfilterrule][1]: query[ConstantScore(*:*)],from[-1],size[-1]: Parse Failure [Failed to parse source [{\"query\":{\"match_all\":{}},\"sort\":[{\"name_sort\":\"asc\"}],\"filter\":{\"and\":[{\"terms\":{\"id\":[]}}]},\"size\":9999,\"from\":0,\"fields\":[\"id\"]}]]]; nested: SearchParseException[[katello_katello::contentviewerratumfilterrule][1]: query[ConstantScore(*:*)],from[-1],size[-1]: Parse Failure [No mapping found for [name_sort] in order to sort on]]; }{[sZsR1HcsSOu_0MFgsdIo5A][katello_katello::contentviewerratumfilterrule][2]: SearchParseException[[katello_katello::contentviewerratumfilterrule][2]: query[ConstantScore(*:*)],from[-1],size[-1]: Parse Failure [Failed to parse source [{\"query\":{\"match_all\":{}},\"sort\":[{\"name_sort\":\"asc\"}],\"filter\":{\"and\":[{\"terms\":{\"id\":[]}}]},\"size\":9999,\"from\":0,\"fields\":[\"id\"]}]]]; nested: SearchParseException[[katello_katello::contentviewerratumfilterrule][2]: query[ConstantScore(*:*)],from[-1],size[-1]: Parse Failure [No mapping found for [name_sort] in order to sort on]]; }]","status":400} /opt/rh/ruby193/root/usr/share/gems/gems/tire-0.6.2/lib/tire/search.rb:145:in `perform' /opt/rh/ruby193/root/usr/share/gems/gems/tire-0.6.2/lib/tire/search.rb:35:in `results' /opt/rh/ruby193/root/usr/share/gems/gems/tire-0.6.2/lib/tire/model/search.rb:105:in `search' /opt/rh/ruby193/root/usr/share/gems/gems/tire-0.6.2/lib/tire/model/search.rb:300:in `search' /opt/rh/ruby193/root/usr/share/gems/gems/katello-2.2.0.51/app/models/katello/glue/elastic_search/items.rb:85:in `retrieve' ... skipped 113 lines 2015-07-13 13:46:17 [I] Completed 500 Internal Server Error in 110ms (Views: 0.5ms | ActiveRecord: 7.5ms) Version-Release number of selected component (if applicable): How reproducible: Steps to Reproduce: 1. Create filter 2. List filter rule 3. Actual results: Error Expected results: Listing of rules Additional info:
Since this issue was entered in Red Hat Bugzilla, the release flag has been set to ? to ensure that it is properly evaluated for this release.
Issue is that Filter rules do not have a name field to sort on Quick patch is below to use the id instead /opt/rh/ruby193/root/usr/share/gems/gems/katello-2.2.0.51/app/controllers/katello/api/v2# diff -u content_view_filter_rules_controller.rb.150714-1 content_view_filter_rules_controller.rb --- content_view_filter_rules_controller.rb.150714-1 2015-07-14 09:37:34.626750747 +0000 +++ content_view_filter_rules_controller.rb 2015-07-14 09:38:25.849705473 +0000 @@ -99,6 +99,10 @@ private + def sort_params + {sort_by: 'id'} + end + def find_filter @filter = ContentViewFilter.find(params[:content_view_filter_id]) end Better would be to have a rule_order field that also allows to specify the order of the rules to be applied
Tested https://sat-perf-04.idm.lab.bos.redhat.com/katello/api/v2/content_view_filters?content_view_id=11&per_page=5 and https://sat-perf-04.idm.lab.bos.redhat.com/katello/api/v2/content_view_filters/1/rules?per_page=5 and neither gave an error in 6.1.1
Listing a content view's filters succeeds when the content view is of type "rpm" or "package_group". It fails when the content view is of type "erratum". I've written a new automated test that verifies this fact, and the traceback in the first comment also mentions errata.
Sorry. That should say "succeeds when the content view **filter** is of type 'rpm' or...".
See the automated test at: https://github.com/SatelliteQE/robottelo/pull/2724
Created redmine issue http://projects.theforeman.org/issues/11920 from this bug
Upstream bug component is WebUI
Upstream bug assigned to tomckay
Per upstream, this was related to elastic search which has been removed. I am moving this to ON_QA for verification.
Verified in Satellite 6.2 Beta Snap 19. GET https://rhsm-qe-1.rhq.lab.eng.bos.redhat.com/katello/api/v2/content_view_filters/6/rules/ { "total": 5, "subtotal": 5, "page": null, "per_page": null, "error": null, "search": null, "sort": { "by": null, "order": null }, "results": [ { "content_view_filter_id": 6, "errata_id": "RHBA-2016:1349", "date_type": "updated", "id": 1, "created_at": "2016-06-30 19:47:56 UTC", "updated_at": "2016-06-30 19:47:56 UTC" }, { "content_view_filter_id": 6, "errata_id": "RHBA-2016:1253", "date_type": "updated", "id": 2, "created_at": "2016-06-30 19:47:56 UTC", "updated_at": "2016-06-30 19:47:56 UTC" }, { "content_view_filter_id": 6, "errata_id": "RHBA-2016:1251", "date_type": "updated", "id": 3, "created_at": "2016-06-30 19:47:56 UTC", "updated_at": "2016-06-30 19:47:56 UTC" }, { "content_view_filter_id": 6, "errata_id": "RHBA-2016:1305", "date_type": "updated", "id": 4, "created_at": "2016-06-30 19:47:56 UTC", "updated_at": "2016-06-30 19:47:56 UTC" }, { "content_view_filter_id": 6, "errata_id": "RHBA-2016:1259", "date_type": "updated", "id": 5, "created_at": "2016-06-30 19:47:56 UTC", "updated_at": "2016-06-30 19:47:56 UTC" } ] }
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2016:1501