Project

General

Profile

Bug #15003

Enable removing override values from sc-params by specifying --match

Added by Iain Walmsley over 4 years ago. Updated 8 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Smart variables
Target version:
-
Difficulty:
Triaged:
Yes
Bugzilla link:
Pull request:
Team Backlog:
Fixed in Releases:
Found in Releases:
In Kanboard:
yes

Description

When adding an sc-param it is possible to specify a --match for an FQDN/Hostgroup;

> hammer sc-param add-override-value --help
Usage:
    hammer sc-param add-override-value [OPTIONS]

Options:
 --match MATCH                                       Override match
 --puppet-class PUPPET_CLASS_NAME                    Puppet class name
 --puppet-class-id PUPPET_CLASS_ID                   ID of Puppet class
 --smart-class-parameter SMART_CLASS_PARAMETER_NAME  Smart class parameter name
 --smart-class-parameter-id SMART_CLASS_PARAMETER_ID
 --use-puppet-default USE_PUPPET_DEFAULT
 --value VALUE                                       Override value
 -h, --help                                          print help

This is not possible with removing the sc-param;

> hammer sc-param remove-override-value --help
Usage:
    hammer sc-param remove-override-value [OPTIONS]

Options:
 --id ID
 --puppet-class PUPPET_CLASS_NAME                    Puppet class name
 --puppet-class-id PUPPET_CLASS_ID                   ID of Puppet class
 --smart-class-parameter SMART_CLASS_PARAMETER_NAME  Smart class parameter name
 --smart-class-parameter-id SMART_CLASS_PARAMETER_ID
 -h, --help                                          print help

This would be especially useful as when you try to re-assign the parameter using Hammer (using add-override-value) it refuses;

Could not create the override_value:
  Validation failed: Match has already been taken

History

#1 Updated by Tomáš Strachota over 3 years ago

  • Tracker changed from Bug to Feature
  • Subject changed from Can't remove a sc-param match using Hammer to Enable removing override values from sc-params by specifying --match
  • Description updated (diff)
  • Category changed from Foreman commands (obsolete) to Smart variables
  • Target version set to 115
  • Bugzilla link set to 1465199

#2 Updated by Tomáš Strachota over 3 years ago

Note that at the moment it's possible to use --id to specify which override value to remove:


> hammer sc-param remove-override-value -h
Usage:
    hammer sc-param remove-override-value [OPTIONS]

Options:
 --id ID                                              
 --puppet-class PUPPET_CLASS_NAME                    Puppet class name
 --puppet-class-id PUPPET_CLASS_ID                   ID of Puppet class
 --smart-class-parameter SMART_CLASS_PARAMETER_NAME  Smart class parameter name
 --smart-class-parameter-id SMART_CLASS_PARAMETER_ID  
 -h, --help                                          print help

> hammer sc-param remove-override-value --smart-class-parameter-id 53 --id 6
Override value deleted

#3 Updated by Jamie Campbell almost 3 years ago

  • Tracker changed from Feature to Bug

Tomáš Strachota wrote:

Note that at the moment it's possible to use --id to specify which override value to remove:
[...]

This should be a bug, not a feature. And it's a pretty serious bug at that.

If I am able to add an override value to a single host using fqdn matcher with a CLI command, I should be able to reverse that action. Currently it is possible to make thousands of host-specific overrides and then have no way to remove them (except the GUI).

That sort of 'one-way-street' is clearly a bug, and it's a bug that sets people up for disaster.

And to Tomáš Strachota's point, the ID is not helpful here. If I have overridden the same value on multiple hosts, they will all have the same ID number so removing them one host at a time is not possible using ID as my criteria.

#4 Updated by Iain Walmsley almost 3 years ago

Just to add to this, this is very much the issue we have. We have implemented (semi-elaborate) ways of caching all ids to get around this functionality at the moment and using them instead but it does complicate things heavily. Seeing the same issue using the API.

#5 Updated by Ondřej Pražák 9 months ago

  • Triaged set to Yes
  • Team Backlog deleted (Marek)

#6 Updated by Shira Maximov 8 months ago

  • In Kanboard set to yes

Also available in: Atom PDF