Bug #17252
Unable to set empty parameter via hammer
Status:
Closed
Priority:
Normal
Assignee:
Category:
Hammer core
Target version:
Difficulty:
Triaged:
Pull request:
Team Backlog:
Description
Hammer doesn't allow to to send nil values, which prevents users from re-setting attributes to their default values in some cases. The only thing a user can do is to send empty string --param=""
but it's not the same as nil.
From the discussions about this topic it seems that one of the solutions could be to use a reserved value, that would be translated to nil internally. Users could override the value using some env variable.
For example:
hammer domain update --name test --dns nil HAMMER_NIL=None hammer domain update --name test --dns None
Related issues
Associated revisions
History
#1
Updated by Tomáš Strachota about 6 years ago
- Related to Bug #13994: Cannot dis-associate a Subnet from a Domain using Hammer added
#2
Updated by Tomáš Strachota about 6 years ago
- Related to Bug #17250: Unable to remove all locations or organizations from a domain added
#3
Updated by Tomáš Strachota about 6 years ago
- Related to Tracker #2823: Tracker for usability issues added
#4
Updated by Martin Bacovsky about 5 years ago
- Target version changed from 115 to 233
- Assignee set to Martin Bacovsky
- Status changed from New to Assigned
#5
Updated by The Foreman Bot about 5 years ago
- Status changed from Assigned to Ready For Testing
- Pull request https://github.com/theforeman/hammer-cli/pull/260 added
#6
Updated by Martin Bacovsky about 5 years ago
- % Done changed from 0 to 100
- Status changed from Ready For Testing to Closed
Applied in changeset cd5cc9d605f5a955ee249cf6630c1465c3a30451.
#7
Updated by Martin Bacovsky about 5 years ago
- Legacy Backlogs Release (now unused) set to 289
#8
Updated by Martin Bacovsky about 5 years ago
- Related to Bug #21768: Support NIL values in searchable options added
#9
Updated by Martin Bacovsky about 5 years ago
- Related to Bug #22009: Invalid routes with NIL as a route param are selected added
Fixes #17252 - Allow empty parameters in hammer (#260)
This change allows user to use nil as a valid value for an argument.
Just before option normalization the 'NIL' string is replaced for
special internal object which help us to distinguish between unused
options and options set to nil. The internal object is replaced with
nil after all options are collected and unused options filtered out.