Bug 1391584

Summary: hammer host list --location returns all hosts
Product: Red Hat Satellite Reporter: Peter Tselios <tselios.petros>
Component: HostsAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED WONTFIX QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2.2CC: aruzicka, dhlavacd, inecas, jcallaha, mhulan, tselios.petros, tstrachota
Target Milestone: UnspecifiedKeywords: Triaged
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: 2018-08-02 20:58:08 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 Peter Tselios 2016-11-03 15:17:28 UTC
Description of problem:
Searching for hosts via hammer CLI returns all registered hosts. 
From the Web UI using the filter ("location = <location_name>") filtering works just fine.

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

How reproducible:
Every time

Steps to Reproduce:
1. Create a Location (Let's say it's UK)
2. Create a few child locations (eg London, Leeds, Reading). 
3. Locations have the UK as a parent
Register some hosts in UK, some in London etc.

hammer host list --location UK returns ALL hosts
hammer host list --location London, correctly, returns only the hosts with location "UK/London".

Actual results:
hammer host list --location UK returns ALL hosts

Expected results:
A list of hosts not assigned to other locations should be returned

Additional info:
It's the same behaviour even if we use the --location-id with the id of the parent location. 

From the Web UI, navigate to Hosts --> All Hosts
In the filter box write "location = UK", press Search.

It displays only the hosts in the specified location.

Comment 2 Marek Hulan 2017-05-22 18:40:50 UTC
Thanks for the report.

I think this is desired behavior. Hammer --location parameter is equivalent to choosing the location in top-left corner. Could you please try selecting UK location there and visiting the hosts page? It should display all hosts that are assigned to UK or any nested location (London, Leeds, Reading). When searching is used, it only finds hosts assigned explicitly to the location. The same results should be observed when you search for hosts with hammer using 

> hammer host list --search 'location = UK'

If you created top-level location Germany with sublocations Munchen and Berlin, it should not list any UK children records as it's separate tree, but it would display all hosts from Berlin and Munchen.

Please let us know, whether you can confirm described behavior.

Comment 4 Peter Tselios 2017-06-06 14:04:55 UTC
That makes a lot of sense. 
However, I don't see a way to find hosts assigned only in the parent location, which is the point of my bug report. 
If this is not supported, then we should change the bug report to an RFE, in my opinion.

Comment 6 Bryan Kearney 2018-08-02 20:58:08 UTC
Thank you for your interest in Satellite 6. We have evaluated this request, and we do not expect this to be implemented in the product in the forseeable future. We are therefore closing this out as WONTFIX. If you have any concerns about this, please feel free to contact Rich Jerrido or Bryan Kearney. Thank you.