Bug #17920

Defaults match on iternal option name, not on the flag name

Added by Tomáš Strachota 11 months ago. Updated 8 months ago.

Status:Closed
Priority:Normal
Assigned To:Tomáš Strachota
Category:Hammer core
Target version:Foreman - Team Marek backlog
Difficulty: Bugzilla link:1339905
Found in release: Pull request:https://github.com/theforeman/hammer-cli/pull/233
Story points-
Velocity based estimate-
Releasehammer-cli-0.10.0Release relationshipAuto

Description

Some options in hammer use internally option name different from the flag that is presented to users. Eg. all expanded resource identifiers:

--organization -> option_organization_name
--location -> option_location_name

Defaults match on the internal name instead of the flag, which is counter-intuitive.

Steps to reproduce:
  1. Create Org1, Org2
  2. Create users jane in Org1 and john in Org2
  3. Save defaults for --organization:
    hammer defaults add --param-name organization --param-value Org1
    
  4. List users:
    hammer user list
    

Actual results:
Ignores saved defaults and prints all users regardless the organization.

Expected results:
Should print only users from Org1

Additional info:
Default value is ignored because it hammer tries to look for "organization_name" and the key in defaults is "organization". Everything works when you save "organization_name" but it's counter-intuitive:

hammer defaults add --param-name organization_name --param-value Org1


Related issues

Blocked by Katello - Bug #19079: Adapt hammer-cli-katello to use the new options changes i... Closed 03/29/2017

Associated revisions

Revision 5bf50733
Added by Tomas Strachota 8 months ago

Fixes #17920 - defaults match on option switch name (#233)

  • Fixes #17920 - defaults match on option switch name

Method #get_default was changed to accept switch (--options) instead of
attribute reader name. The internal format of how the defaults are saved
remain the same.

History

#1 Updated by Tomáš Strachota 9 months ago

  • Status changed from New to Assigned
  • Assigned To set to Tomáš Strachota

#2 Updated by The Foreman Bot 9 months ago

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

#3 Updated by Tomáš Strachota 8 months ago

  • Release set to hammer-cli-0.10.0

#4 Updated by Anonymous 8 months ago

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

#5 Updated by Andrew Kofink 8 months ago

  • Blocked by Bug #19079: Adapt hammer-cli-katello to use the new options changes in hammer-cli added

Also available in: Atom PDF