Project

General

Profile

Bug #17252

Unable to set empty parameter via hammer

Added by Tomáš Strachota about 6 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Category:
Hammer core
Target version:
Difficulty:
Triaged:
Bugzilla link:
Team Backlog:
Fixed in Releases:
Found in Releases:
In Kanboard:
Red Hat JIRA:

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

Related to Hammer CLI - Bug #13994: Cannot dis-associate a Subnet from a Domain using HammerClosed
Related to Hammer CLI - Bug #17250: Unable to remove all locations or organizations from a domainClosed
Related to Hammer CLI - Tracker #2823: Tracker for usability issuesClosed

Related to Hammer CLI - Bug #21768: Support NIL values in searchable optionsClosed2017-11-26
Related to Hammer CLI - Bug #22009: Invalid routes with NIL as a route param are selectedClosed2017-12-18

Associated revisions

Revision cd5cc9d6 (diff)
Added by Martin Bacovsky about 5 years ago

Fixes #17252 - Allow empty parameters in hammer (#260)

  • 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.

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

#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

#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

Also available in: Atom PDF