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 1510964

Summary: Message when trying to order by attribute not supporting ordering is not helpful
Product: Red Hat Satellite 6 Reporter: Martin Bacovsky <mbacovsk>
Component: HammerAssignee: Swapnil Abnave <sabnave>
Status: CLOSED ERRATA QA Contact: Lukáš Hellebrandt <lhellebr>
Severity: low Docs Contact:
Priority: unspecified    
Version: 6.3.0CC: akarsale, aruzicka, dhlavacd, inecas, lhellebr, mhulan, rabajaj, tstrachota
Target Milestone: UnspecifiedKeywords: Triaged, VerifiedUpstream
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-16 18:58:29 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 Martin Bacovsky 2017-11-08 13:34:30 UTC
Description of problem:

# hammer host list --order id
Error: 400 Bad Request

The id has not defined ordering on it so the failure is expected but the message is not helpful. The API sends nice message which is not propagated by hammer

[ERROR 2017-11-08 08:20:18 API] 400 Bad Request
[DEBUG 2017-11-08 08:20:18 API] {
    "error" => {
        "message" => "the field 'id' in the order statement is not valid field for search",
          "class" => "ScopedSearch::QueryNotSupported"

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

How reproducible:

Steps to Reproduce:
1. hammer host list --order id
2. see the ouptut

Actual results:
Error: 400 Bad Request

Expected results:
Error: the field 'id' in the order statement is not valid field for search

Additional info:

Comment 1 Swapnil Abnave 2017-11-10 08:47:44 UTC
Created redmine issue from this bug

Comment 2 Brad Buckingham 2017-11-13 21:28:55 UTC
When addressing this, please be sure that the user behavior is consistent regardless of which part of the application is being used.  E.g. foreman or plugins (e.g. katello, discovery...etc).

Comment 4 2017-12-07 15:08:25 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue has been resolved.

Comment 6 Lukáš Hellebrandt 2018-06-28 12:02:47 UTC
FailedQA on Sat 6.4 snap 9.

1) Failing this based on comment 2. Although the message is now shown by Hammer, the behavior is inconsistent in the fact that some entities are sortable by id and some are not:

# hammer host list --organization-id 1 --order id
400 Bad Request
  the field 'id' in the order statement is not valid field for search

# hammer activation-key list --organization-id 1 --order id
[sorted table]

2) Additionally, the message is still not correct: it says 'id is not valid field for search' while I am not attempting to *search*, I am attempting to *order*. That is, however, an issue of what the API itself returns.

I can verify this and create a new BZ for issue 1), but as Brad specifically requested consistency check for this, I am failing the BZ for now.

Comment 7 Ivan Necas 2018-06-28 13:28:53 UTC
The purpose of the BZ was just to make sure we propagate more info on bad request. I would say both 1) and 2) are valid bugs (although with low prio), but since they are in different component, and the hammer itself was fixed, I would suggest keeping this as verified and filing BZs with the other findings.

Comment 8 2018-06-28 14:07:49 UTC
Upstream bug assigned to

Comment 9 Lukáš Hellebrandt 2018-06-29 09:23:29 UTC
Verifying as per comments 6 and 7.

Will report mentioned issues as separate BZs.

Comment 11 Bryan Kearney 2018-10-16 18:58:29 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.