Bug 1598555

Summary: [RFE] foreman-tasks: bulk_search does not support paging results
Product: Red Hat Satellite Reporter: Brad Buckingham <bbuckingham>
Component: Tasks PluginAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED WONTFIX QA Contact: Peter Ondrejka <pondrejk>
Severity: low Docs Contact:
Priority: unspecified    
Version: 6.4CC: aruzicka, inecas
Target Milestone: UnspecifiedKeywords: FutureFeature
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-11-04 14:03:29 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Brad Buckingham 2018-07-05 19:26:33 UTC
Description of problem:

The foreman_tasks bulk_search API does not support paging the results. 

Below is an example where usage of the API can result in a lot of result displayed to the user.

Note: the behavior described here was initially raised by bug 1500090; however, that bug raised 2 items and only 1 was addressed.  This is to track the second issue (paging)

Version-Release number of selected component (if applicable):
tfm-rubygem-foreman-tasks-0.13.2-1.el7sat.noarch
tfm-rubygem-foreman-tasks-core-0.2.5-1.el7sat.noarch
tfm-rubygem-katello-3.7.0.rc1.2-0.1.rc1.2.el7sat.noarch

How reproducible:
always

Steps to Reproduce:
1. go to Content -> Products
2. click Repo Discovery
3. select Repository Type - 'Container Images'
4. enter Registry to Discover - 'registry.access.redhat.com'
5. click Discover

Actual results:

~800 repositories are discovered and listed

Expected results:

The results can be paged, similar to other areas of the app.

Additional info:

The results displayed appear to be a result of the following API call:

POST foreman_tasks/api/tasks/bulk_search
{searches: [{type: "task", task_id: "78e783a0-1005-4588-a07f-de4bd10db2ce", search_id: "1"}]}

The response returned contains an output element (array) listing the 800 results.

Comment 1 Adam Ruzicka 2018-07-17 11:23:29 UTC
The thing with bulk_search is you can provide several queries to search by and (if I'm reading the code right) each of these can have different per_page and page values. So it most likely does support pagination in a non-standard way.

The problem with repo discovery is that it creates a single task which detects the repos and then the list of repos is loaded from that single task. No matter how hard one would try to paginate the bulk_search it would always behave the same way because there's just one task.

We should probably think about whether we still need the bulk_search endpoint (is it used anywhere? could it be replaced by a call to index?) and maybe file another BZ (or reuse this one) to cover the repo discovery pagination.

Comment 2 Bryan Kearney 2019-11-04 14:03:29 UTC
Thank you for your interest in Satellite 6. We have evaluated this request, and while we recognize that it is a valid request, we do not expect this to be implemented in the product in the foreseeable future. This is due to other priorities for the product, and not a reflection on the request itself. We are therefore closing this out as WONTFIX. If you have any concerns about this, please do not reopen. Instead, feel free to contact Red Hat Technical Support. Thank you.