Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1516929 - API gives subtotal=0 when per_page=0 and thin=true and search string is used
Summary: API gives subtotal=0 when per_page=0 and thin=true and search string is used
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite 6
Classification: Red Hat
Component: API
Version: 6.2.11
Hardware: x86_64
OS: Linux
high
high vote
Target Milestone: Unspecified
Assignee: Amir
QA Contact: Peter Ondrejka
URL:
Whiteboard:
: 1560055 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-11-23 15:30 UTC by Dmitry Zhukovski
Modified: 2019-04-01 20:27 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-10-16 19:27:32 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Foreman Issue Tracker 23599 None None None 2018-06-21 11:17:51 UTC

Internal Links: 1560055

Description Dmitry Zhukovski 2017-11-23 15:30:52 UTC
Description of problem:
API gives subtotal=0 when per_page=0 and search string is used

Version-Release number of selected component (if applicable):
6.2.11

How reproducible:
Everytime

Steps to Reproduce:
1. Install sat6 server
2. Define two hosts test1 & test2
3. run curl -u admin:xxx -X GET 'https://sat6/api/v2/hosts?per_page=0&thin=true&search=name+~+"test"

Actual results:
{
  "total": 3,
  "subtotal": 0,        <==============
  "page": 1,
  "per_page": 0,
  "search": "name ~ \"test\"",
  "sort": {
    "by": null,
    "order": null
  },
  "results": []
}


Expected results:
{
  "total": 3,
  "subtotal": 2,   <==============
  "page": 1,
  "per_page": 0,
  "search": "name ~ \"test\"",
  "sort": {
    "by": null,
    "order": null
  },
  "results": []
}


Additional info:
Different combinations give correct "subtotal":

without thin=true:

curl -u admin:xxx -X GET 'https://sat6/api/v2/hosts?per_page=0&search=name+~+"test"'
{
  "total": 3,
  "subtotal": 2,
  "page": 1,
  "per_page": 0,
  "search": "name ~ \"test\"",
  "sort": {
    "by": null,
    "order": null
  },
  "results": []
}

without search:
curl -u admin:xxx -X GET 'https://sat6/api/v2/hosts?per_page=0&thin=true'
{
  "total": 3,
  "subtotal": 3,
  "page": 1,
  "per_page": 0,
  "search": null,
  "sort": {
    "by": null,
    "order": null
  },
  "results": []
}

without per_page:
curl -u admin:xxx -X GET 'https://sat6/api/v2/hosts?thin=true&search=name+~+"test"'
{
  "total": 3,
  "subtotal": 2,
  "page": 1,
  "per_page": 20,
  "search": "name ~ \"test\"",
  "sort": {
    "by": null,
    "order": null
  },
  "results": [{"id":2,"name":"test1"},{"id":3,"name":"test2"}]

Comment 2 Marek Hulan 2018-01-19 11:27:41 UTC
Created redmine issue http://projects.theforeman.org/issues/22326 from this bug

Comment 3 Amit Karsale 2018-05-29 09:42:42 UTC
*** Bug 1560055 has been marked as a duplicate of this bug. ***

Comment 4 pm-sat@redhat.com 2018-06-18 12:06:43 UTC
Upstream bug assigned to akarsale@redhat.com

Comment 7 Peter Ondrejka 2018-08-27 12:57:13 UTC
Verified on sat 6.4 snap 19, subtotal now reflects the search result with per_page and thin options enabled:

curl -u admin:changeme -X GET 'https://.../api/v2/hosts?per_page=0&thin=true&search=name+~+"1"' 
{
  "total": 5,
  "subtotal": 2,
  "page": 1,
  "per_page": 0,
  "search": "name ~ \"1\"",
  "sort": {
    "by": null,
    "order": null
  },
  "results": []
}

Comment 8 Bryan Kearney 2018-10-16 19:27:32 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/RHSA-2018:2927


Note You need to log in before you can comment on or make changes to this bug.