Project

General

Profile

Bug #26961

Field filtering (--fileds option) prints more fields then requested

Added by Martin Bacovsky 4 months ago. Updated 4 months ago.

Status:
Closed
Priority:
Normal
Category:
Hammer core
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

Currently fields prints all fields that start with the field in the list. I like the possibilities this opens but would prefer it to be rather opt-in.

Current state:

hammer host info --id 4 --fields network
Network:            
    IPv4 address: 192.168.121.172
    MAC:          52:54:00:c8:6b:01
    Subnet ipv4:  pichi.example.com
    Domain:       pichi.example.com
Network interfaces: 
 1) Id:           4
    Identifier:   eth0
    Type:         interface (primary, provision)
    MAC address:  52:54:00:c8:6b:01
    IPv4 address: 192.168.121.172
    FQDN:         centos7.pichi.example.com

I would expect only "Network" to be printed as it is what I asked for. Possibility to have 'hammer host info --id 4 --fields network*' for what we see today would be nice and useful.

Associated revisions

Revision 04f358b5 (diff)
Added by Martin Bacovsky 4 months ago

Fixes #26961 - Filter fields properly

This patch makes filtering by label more strict.
- exact match is required
- wildcard supported (just '*' at the and)
- only fields from the DEFAULT set printed by default

History

#1 Updated by Martin Bacovsky 4 months ago

One more issue was detected - when no --fields is provided filter by sets is ignored. It results in situation when if some fields are in 'ALL' set and not in the DEFAULT one they are printed when no --fields is used. Id expect such fields to be printed only when --fields ALL is explicitly used.

#2 Updated by The Foreman Bot 4 months ago

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

#3 Updated by Martin Bacovsky 4 months ago

  • Status changed from Ready For Testing to Closed

Also available in: Atom PDF