Unable to set empty parameter via hammer
|Assigned To:||Martin Bacovsky|
|Target version:||Foreman - Team Ivan - Iteration 23|
|Found in release:||Pull request:||https://github.com/theforeman/hammer-cli/pull/260|
|Velocity based estimate||-|
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.
hammer domain update --name test --dns nil HAMMER_NIL=None hammer domain update --name test --dns None
- Fixes #17252 - Allow empty parameters in hammer
This change allows user to use nil as a valid value for an argument.
$ hammer command --option=NIL
$ HAMMER_NIL=NULL hammer command --option=NULL
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.