Bug 1123859 - Missing search option for subscriptions
Summary: Missing search option for subscriptions
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Subscription Management
Version: 6.0.3
Hardware: x86_64
OS: Linux
unspecified
medium vote
Target Milestone: Unspecified
Assignee: Christine Fouant
QA Contact: Tazim Kolhar
URL:
Whiteboard:
Depends On:
Blocks: 1122832
TreeView+ depends on / blocked
 
Reported: 2014-07-28 13:34 UTC by Peter Vreman
Modified: 2017-02-23 21:10 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-08-12 13:55:19 UTC


Attachments (Terms of Use)

Description Peter Vreman 2014-07-28 13:34:54 UTC
Description of problem:
Missing search option for subscriptions. In the API documentation the search optional is also not mentioned.
The search box on the webpage is also not working
Having a search option makes it easier to retrieve the correct version in a single query without parsing the complete JSON output.

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

How reproducible:


Steps to Reproduce:
1. curl -XGET --data-urlencode "search=product_name=Extended Update Support" https://localhost/katello/api/v2/organizations/4/subscriptions
{"total":7,"subtotal":0,"offset":null,"limit":null,"search":"product_name=Extended Update Support","sort":{"by":null,"order":null},"results":[]}
2.
3.

Actual results:
Results contain the item of the searched product_name only

Expected results:


Additional info:

Comment 1 RHEL Product and Program Management 2014-07-28 14:04:21 UTC
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.

Comment 3 Tom McKay 2014-07-28 14:35:22 UTC
There are inconsistencies in search syntax for internal Satellite-6 objects: Some use the upstream foreman syntax, while others use the upstream katello syntax. In the case of subscriptions, being related to content, the katello syntax is used (the search engine is elasticsearch).

Below are two examples. First, note the "product_name:High\ Availability" (the colon and escaped space). In the second request note the asterick to perform non-exact match.

The general inconsistency is a known issue. If this response satisfies your issue, please close it or add further information.

$ curl -u admin:changeme -XGET --data-urlencode "search=product_name:High\ Availability" "http://localhost:3000/katello/api/v2/organizations/3/subscriptions"
{"total":9,"subtotal":1,"page":1,"per_page":20,"search":"product_name:High\\ Availability","sort":{"by":null,"order":null},"results":[{"organization":{"name":"Mega Corporation","label":"megacorp"},"id":"8a8d01a247408ec10147452373f10236","product_name":"High Availability","start_date":"2013-12-31","end_date":"2014-12-31","available":100,"quantity":100,"consumed":0,"account_number":null,"contract_number":null,"support_level":"Layered","product_id":"RH00025","virt_only":false,"sockets":2,"ram":0,"instance_multiplier":2,"stacking_id":"RH00025","multi_entitlement":true}]}

$ curl -u admin:changeme -XGET --data-urlencode "search=product_name:High\ Avail*" "http://localhost:3000/katello/api/v2/organizations/3/subscriptions"
{"total":9,"subtotal":2,"page":1,"per_page":20,"search":"product_name:High\\ Avail*","sort":{"by":null,"order":null},"results":[{"organization":{"name":"Mega Corporation","label":"megacorp"},"id":"8a8d01a247408ec10147452373f10236","product_name":"High Availability","start_date":"2013-12-31","end_date":"2014-12-31","available":100,"quantity":100,"consumed":0,"account_number":null,"contract_number":null,"support_level":"Layered","product_id":"RH00025","virt_only":false,"sockets":2,"ram":0,"instance_multiplier":2,"stacking_id":"RH00025","multi_entitlement":true},{"organization":{"name":"Mega Corporation","label":"megacorp"},"id":"8a8d01a247408ec1014745237381017f","product_name":"High Availability for Unlimited Guests","start_date":"2013-12-31","end_date":"2014-12-31","available":1,"quantity":1,"consumed":0,"account_number":null,"contract_number":null,"support_level":"Layered","product_id":"RH00059","virt_only":false,"sockets":2,"ram":0,"instance_multiplier":null,"stacking_id":"RH00059","multi_entitlement":true}]}

Comment 4 Peter Vreman 2014-08-05 15:31:05 UTC
The different search syntax does not work for me either:

Test that the product_name is available by listing all items:

# curl -K /opt/hoici/etc/curl-hoici.conf -H 'Content-Type: application/json' -d '{"per_page":"9999"}' -XGET https://localhost/katello/api/v2/organizations/4/subscriptions  | jq . | grep Extended
      "product_name": "Extended Update Support",

Output of with search parameters:

# curl -K /opt/hoici/etc/curl-hoici.conf -H 'Content-Type: application/json' -d '{"per_page":"9999","search":"product_name:Extended Update Support"}' -XGET https://localhost/katello/api/v2/organizations/4/subscriptions | jq .
{
  "results": [],
  "sort": {
    "order": null,
    "by": null
  },
  "search": "product_name:Extended Update Support",
  "limit": null,
  "offset": null,
  "subtotal": 0,
  "total": 7
}


]# curl -K /opt/hoici/etc/curl-hoici.conf -H 'Content-Type: application/json' -d '{"per_page":"9999","search":"product_name:Extended*"}' -XGET https://localhost/katello/api/v2/organizations/4/subscriptions | jq .
{
  "results": [],
  "sort": {
    "order": null,
    "by": null
  },
  "search": "product_name:Extended*",
  "limit": null,
  "offset": null,
  "subtotal": 0,
  "total": 7
}

Comment 6 Tazim Kolhar 2015-04-02 10:56:05 UTC
VERIFIED:

# rpm -qa | grep foreman
foreman-postgresql-1.7.2.15-1.el6_6sat.noarch
foreman-ovirt-1.7.2.15-1.el6_6sat.noarch
ruby193-rubygem-foreman-tasks-0.6.12.3-1.el6_6sat.noarch
rubygem-hammer_cli_foreman_bootdisk-0.1.2.5-1.el6_6sat.noarch
ruby193-rubygem-foreman-redhat_access-0.1.0-1.el6_6sat.noarch
rubygem-hammer_cli_foreman-0.1.4.7-1.el6_6sat.noarch
rubygem-hammer_cli_foreman_tasks-0.0.3.3-1.el6_6sat.noarch
foreman-1.7.2.15-1.el6_6sat.noarch
foreman-gce-1.7.2.15-1.el6_6sat.noarch
ruby193-rubygem-foreman_bootdisk-4.0.2.10-1.el6_6sat.noarch
ruby193-rubygem-foreman_gutterball-0.0.1.9-1.el6_6sat.noarch
foreman-debug-1.7.2.15-1.el6_6sat.noarch
rubygem-hammer_cli_foreman_discovery-0.0.1.4-1.el6_6sat.noarch
foreman-selinux-1.7.2.13-1.el6_6sat.noarch
qe-sat6-rhel66.usersys.redhat.com-foreman-proxy-1.0-2.noarch
foreman-compute-1.7.2.15-1.el6_6sat.noarch
ruby193-rubygem-foreman_docker-1.2.0.7-1.el6_6sat.noarch
ruby193-rubygem-foreman_discovery-2.0.0.9-1.el6_6sat.noarch
foreman-libvirt-1.7.2.15-1.el6_6sat.noarch
foreman-proxy-1.7.2.4-1.el6_6sat.noarch
qe-sat6-rhel66.usersys.redhat.com-foreman-client-1.0-1.noarch
qe-sat6-rhel66.usersys.redhat.com-foreman-proxy-client-1.0-1.noarch
ruby193-rubygem-foreman_hooks-0.3.7-2.el6_6sat.noarch
foreman-vmware-1.7.2.15-1.el6_6sat.noarch


# curl -XGET -u admin "search=product_name=Red Hat Employee Subscription" https://qe-sat6-rhel66.usersys.redhat.com/katello/api/v2/organizations/1/subscriptions
Enter host password for user 'admin':

{"total":2,"subtotal":2,"page":1,"per_page":89349,"search":"product_name=Red Hat Employee Subscription","sort":{"by":null,"order":null},"results":[{"organization":{"name":"Default Organization","label":"Default_Organization","id":1},"id":"ff8080814c72dd24014c748a8b9e4768","product_name":"Red Hat Employee Subscription","start_date":"2013-04-24","end_date":"2022-01-01","available":10,"quantity":10,"consumed":0,"account_number":"477931","contract_number":"10169793","support_level":"SELF-SUPPORT","product_id":"ES0113909","virt_only":false,"sockets":128,"ram":0,"instance_multiplier":null,"stacking_id":"","multi_entitlement":false}]}

Comment 7 Bryan Kearney 2015-08-11 13:28:44 UTC
This bug is slated to be released with Satellite 6.1.

Comment 8 Bryan Kearney 2015-08-12 13:55:19 UTC
This bug was fixed in version 6.1.1 of Satellite which was released on 12 August, 2015.


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