Bug #21627

Message when trying to order by attribute not supporting ordering is not helpful

Added by Swapnil Abnave 6 months ago. Updated 2 months ago.

Status:Closed
Priority:Normal
Assigned To:Swapnil Abnave
Category:Other commands
Target version:Foreman - Team Anurag Iteration 22
Difficulty: Bugzilla link:1510964
Found in release: Pull request:https://github.com/theforeman/hammer-cli-foreman/pull/341
Story points-
Velocity based estimate-

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1510964

Description of problem:

  1. 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:
Always

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

Actual results:
Error: 400 Bad Request

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

Additional info:

Associated revisions

Revision c2a64ec3
Added by Swapnil Abnave 6 months ago

Fixes #21627 - handle 400 bad request - concat response message

History

#1 Updated by The Foreman Bot 6 months ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/hammer-cli/pull/259 added

#2 Updated by The Foreman Bot 6 months ago

  • Pull request https://github.com/theforeman/hammer-cli-foreman/pull/341 added

#3 Updated by Swapnil Abnave 6 months ago

  • Pull request deleted (https://github.com/theforeman/hammer-cli/pull/259)

#4 Updated by Swapnil Abnave 6 months ago

  • Target version set to Team Anurag Iteration 22

#5 Updated by Swapnil Abnave 6 months ago

  • % Done changed from 0 to 100
  • Status changed from Ready For Testing to Closed

#6 Updated by Lukáš Hellebrandt 2 months ago

Verified with tfm-rubygem-hammer_cli-0.12.0-1.

$ hammer --version
hammer (0.12.0) * hammer_cli_foreman (0.13.pre.develop) * hammer_cli_foreman_bootdisk (0.1.3) * hammer_cli_foreman_docker (unknown version) * hammer_cli_foreman_tasks (unknown version) * hammer_cli_katello (0.11.0)

$ hammer host list --order id
[Foreman] Username: <login>
[Foreman] Password for admin:
400 Bad Request
the field 'id' in the order statement is not valid field for search

Also available in: Atom PDF