Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1372815

Summary: Hostgroups API Call Returns Incorrect Data
Product: Red Hat Satellite Reporter: Josh Foots <jfoots>
Component: Host GroupAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED NOTABUG QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: 6.2.0CC: andrew.schofield, bbuckingham, jcallaha, jfoots, jswensso, kabbott, ohadlevy
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-30 14:11:24 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 Josh Foots 2016-09-02 19:01:12 UTC
Description of problem:

Making the rest call to https://satellite.example.com/api/v2/hostgroups?title="test/EA/ENG" returns 3 hostgroups, not just the one with the title "test/EA/ENG". The data returned is:

{
  "total": 3,
  "subtotal": 3,
  "page": 1,
  "per_page": 20,
  "search": null,
  "sort": {
    "by": null,
    "order": null
  },
  "results": [
    {
      "subnet_id": null,
      "subnet_name": null,
      "operatingsystem_id": null,
      "operatingsystem_name": null,
      "domain_id": null,
      "domain_name": null,
      "environment_id": null,
      "environment_name": null,
      "compute_profile_id": null,
      "compute_profile_name": null,
      "ancestry": null,
      "parent_id": null,
      "parent_name": null,
      "puppet_proxy_id": null,
      "puppet_ca_proxy_id": null,
      "ptable_id": null,
      "ptable_name": null,
      "medium_id": null,
      "medium_name": null,
      "architecture_id": null,
      "architecture_name": null,
      "realm_id": null,
      "realm_name": null,
      "created_at": "2016-08-31 13:52:48 UTC",
      "updated_at": "2016-08-31 13:52:48 UTC",
      "id": 1,
      "name": "test",
      "title": "test"
    },
    {
      "subnet_id": null,
      "subnet_name": null,
      "operatingsystem_id": null,
      "operatingsystem_name": null,
      "domain_id": null,
      "domain_name": null,
      "environment_id": null,
      "environment_name": null,
      "compute_profile_id": null,
      "compute_profile_name": null,
      "ancestry": "1",
      "parent_id": 1,
      "parent_name": "HG_CSL3.1.1",
      "puppet_proxy_id": null,
      "puppet_ca_proxy_id": null,
      "ptable_id": null,
      "ptable_name": null,
      "medium_id": null,
      "medium_name": null,
      "architecture_id": null,
      "architecture_name": null,
      "realm_id": null,
      "realm_name": null,
      "created_at": "2016-08-31 13:53:06 UTC",
      "updated_at": "2016-08-31 13:53:06 UTC",
      "id": 2,
      "name": "EA",
      "title": "HG_CSL3.1.1/EA"
    },
    {
      "subnet_id": null,
      "subnet_name": null,
      "operatingsystem_id": null,
      "operatingsystem_name": null,
      "domain_id": null,
      "domain_name": null,
      "environment_id": null,
      "environment_name": null,
      "compute_profile_id": null,
      "compute_profile_name": null,
      "ancestry": "1/2",
      "parent_id": 2,
      "parent_name": "HG_CSL3.1.1/EA",
      "puppet_proxy_id": null,
      "puppet_ca_proxy_id": null,
      "ptable_id": null,
      "ptable_name": null,
      "medium_id": null,
      "medium_name": null,
      "architecture_id": null,
      "architecture_name": null,
      "realm_id": null,
      "realm_name": null,
      "created_at": "2016-08-31 13:53:18 UTC",
      "updated_at": "2016-08-31 13:53:18 UTC",
      "id": 3,
      "name": "ENG",
      "title": "HG_CSL3.1.1/EA/ENG"
    }
  ]


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

6.2.1 GA

How reproducible:

Very 

Steps to Reproduce:
1. Make the above listed API call and view the returned data
2.
3.

Actual results:


Expected results:




https://satellite.example.com/api/v2/hostgroups?search=title="test/EA/ENG"

which returns:

{
  "total": 3,
  "subtotal": 1,
  "page": 1,
  "per_page": 20,
  "search": "\"test/EA/ENG\"",
  "sort": {
    "by": null,
    "order": null
  },
  "results": [
    {
      "subnet_id": null,
      "subnet_name": null,
      "operatingsystem_id": null,
      "operatingsystem_name": null,
      "domain_id": null,
      "domain_name": null,
      "environment_id": null,
      "environment_name": null,
      "compute_profile_id": null,
      "compute_profile_name": null,
      "ancestry": "1/2",
      "parent_id": 2,
      "parent_name": "test/EA",
      "puppet_proxy_id": null,
      "puppet_ca_proxy_id": null,
      "ptable_id": null,
      "ptable_name": null,
      "medium_id": null,
      "medium_name": null,
      "architecture_id": null,
      "architecture_name": null,
      "realm_id": null,
      "realm_name": null,
      "created_at": "2016-08-31 13:53:18 UTC",
      "updated_at": "2016-08-31 13:53:18 UTC",
      "id": 3,
      "name": "ENG",
      "title": "test/EA/ENG"
    }
  ]
}

Additional info:

Comment 1 Brad Buckingham 2016-09-06 17:06:48 UTC
As an alternative, does search by title work in the UI?

Comment 3 Josh Foots 2016-09-19 14:30:02 UTC
(In reply to Brad Buckingham from comment #1)
> As an alternative, does search by title work in the UI?

Customer is not interested in using the UI. I haven't tested the results out in the UI.

Comment 4 Ohad Levy 2016-11-30 14:11:24 UTC
Josh, I beleive you are not using the API correctly, the correct way to search a hostgroup based on its name or title is:


https://satellite.example.com/api/v2/hostgroups?search=title=test/EA/ENG

I'm not sure why you think title is a valid query parameter?

Please re-open in case I've missed something - thanks!