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:

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!