Feature #22389

Hammer output should display context akin to the UI Org/Loc switcher

Added by Eric Helms 3 months ago. Updated 3 months ago.

Status:Assigned
Priority:High
Assigned To:Martin Bacovsky
Category:Hammer core
Target version:Team Ivan - Iteration 27
Difficulty: Bugzilla link:
Found in release: Pull request:
Story points-
Velocity based estimate-

Description

If a user has set a default context, for example wanting to always get data from Acme organization, that should be displayed as part of all output when making hammer requests. This would provide contextual information akin to the UI and help users to understand that the data they are viewing is scoped by context. This can help prevent issues where users expectations for data returned are not met.


Related issues

Related to Hammer CLI - Tracker #2823: Tracker for usability issues New 07/24/2013

History

#1 Updated by Tomáš Strachota 3 months ago

  • Priority changed from Normal to High
  • Category set to Hammer core

#2 Updated by Tomáš Strachota 3 months ago

#3 Updated by Tomáš Strachota 3 months ago

This is an important feature. Eric, do you know if API responses contain the context? I'd expect it in some headers.

It's crucial to add such information especially to output of list commands and to "not found" error messages across the whole CLI.

#4 Updated by Martin Bacovsky 3 months ago

  • Target version set to Team Ivan - Iteration 27
  • Assigned To set to Martin Bacovsky
  • Status changed from New to Assigned

@Eric would it be acceptable if the information is displayed only in debug mode? I have PR ready to add the current taxonomies to the response headers. The response headers are printed in hammer debug mode. Advantage of this approach is that the taxonomies are displayed for each API subcall we do during the Hammer command execution.

This is what could be seen in the output for each request:

[DEBUG 2018-01-24 12:40:21 API] Response headers: {
                                 :date => "Wed, 24 Jan 2018 12:40:01 GMT",
                               :server => "Apache/2.4.6 (Red Hat Enterprise Linux)",
                      :foreman_version => "1.15.6.30",
                  :foreman_api_version => "2",
                 :current_organization => "1; Default Organization",
                     :current_location => "; ANY",
...

If this is okay, no changes in Hammer are needed and I'll switch the component to Foreman/API

#5 Updated by Tomáš Strachota 3 months ago

Martin, I think we need to display the information on stdout with each info command (and also other commands as I described in my previous comment). This is IMHO to inform users which context they're in.

This feature should use your PR. Can you provide a link, please?

Also available in: Atom PDF