Bug #14725

Verbose mode does not work and is inconsistent

Added by Lukas Zapletal about 2 years ago. Updated 3 months ago.

Status:Ready For Testing
Assigned To:Oleh Fedorenko
Category:Hammer core
Target version:Foreman - Team Marek backlog
Difficulty: Bugzilla link:
Found in release: Pull request:https://github.com/theforeman/hammer-cli-foreman/pull/344, https://github.com/theforeman/hammer-cli/pull/263
Story points-
Velocity based estimate-


Global flag -v does not seem to work at all.

Do not remove it, it makes sense to have it. In UNIX, commands usually do not print info messages (like "Host created"). Create a method like print_verbose and use it for all info messages (crate, update, delete). These messages should appear on stdout only when -v flag was provided.

Related issues

Related to Hammer CLI - Tracker #14914: Tracker for output related issues New 05/03/2016


#1 Updated by Tomáš Strachota about 2 years ago

#2 Updated by Tomáš Strachota over 1 year ago

  • Target version set to Team Marek backlog

#3 Updated by Oleh Fedorenko 6 months ago

  • Assigned To set to Oleh Fedorenko
  • Status changed from New to Assigned

#4 Updated by Tomáš Strachota 6 months ago

I'm adding some implementation notes.

At the moment -v has the same effect as -d - it prints logs to stdout. I don't think it was a good choice and in my opinion we should keep only -d for that purpose. At the same time I think it would be confusing for users if we suddenly started using that flag for something else. We should deprecate it first. --verbosity or something similar could be used from the start (it's longer I know).

Verbosity should be added to following places in hammer output:
  • add verbosity attribute to #print_message, default is 1
  • add verbosity attribute to #print_error, not sure what the default value should be here
  • add verbosity to fields in output definition
    All those messages/fields would be printed only when their verbosity is <= than what a user asked for.

Verbosity should also be configurable in settings.
In order to keep the current behavior unless user explicitly changes the settings, I think that what Lukas describes should be verbosity 0 and default should be 1 (or some other value, but one step higher).

PS: Pagination details in #print_record methods should probably be printed only with higher verbosities.

#5 Updated by The Foreman Bot 5 months ago

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

#6 Updated by The Foreman Bot 5 months ago

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

Also available in: Atom PDF