Bug 1465199

Summary: [RFE] Enable removing override values from sc-params by specifying --match
Product: Red Hat Satellite Reporter: jalviso <jalviso>
Component: Smart VariablesAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED WONTFIX QA Contact: Peter Ondrejka <pondrejk>
Severity: medium Docs Contact:
Priority: unspecified    
Version: UnspecifiedCC: andrew.schofield, arahaman, bkearney, dhlavacd, ess-unisys, inecas, jcallaha, orabin
Target Milestone: UnspecifiedKeywords: FutureFeature
Target Release: Unused   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-02-28 19:34:59 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description jalviso 2017-06-27 00:24:21 UTC
Description of problem:

While it is possible to specify a match for an FQDN or Hostgroup using
"hammer sc-param", it is not possible to specify a match with removing sc-param;

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

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 

Version-Release number of selected component (if applicable): 6.2+

How reproducible: Always

Steps to Reproduce:

1. Identify the smart class parameter id:

# hammer sc-param list
---|--------------------|-----------------------------------------------------|----------|-----------------------
ID | PARAMETER          | DEFAULT VALUE                                       | OVERRIDE | PUPPET CLASS          
---|--------------------|-----------------------------------------------------|----------|-----------------------
20 | template           | motd/motd.erb                                       | true     | motd   

# hammer sc-param remove-override-value --smart-class-parameter-id 20 --match fqdn=rhel7.gsslab.bne.redhat.com

Actual results:

# hammer sc-param remove-override-value --smart-class-parameter-id 20 --match fqdn=rhel7.gsslab.bne.redhat.com
Could not delete the override value:
  Error: Unrecognised option '--match'
  
  See: 'hammer sc-param remove-override-value --help'


Expected results:

The appropriate override should be removed by looking up the FQDN match but there is no available option  "--match MATCH Override match".

Additional info:

It would be useful to have the ability to remove an override via a matcher in the same way it can be added.

Comment 1 jalviso 2017-06-27 00:25:26 UTC
Upstream bugzilla exist with this same issue;

http://projects.theforeman.org/issues/15003
Can't remove a sc-param match using Hammer

Comment 2 Tomas Strachota 2017-06-27 11:32:21 UTC
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

Comment 3 jalviso 2017-06-28 04:49:54 UTC
Hi Tomas,

Thank you for your update.

Here is the customer's reason as to why --match option is useful than specifying --id:

+------------------------------------------------------------------------------+
To give you an idea of why that isn't a useful solution I'll outline what we're trying to achieve.
We use puppet to control who has sudo access on individual hosts. This requires we create a matcher against the fqdn of the host with the appropriate sudo rules as an override to our default set of rules. That works fine. The problem is, Foreman doesn't allow you to replace a fqdn match with a new one, you have to actually remove the match then read it, otherwise foreman throws an error that the match is already taken. Accurately determining which id applies to which match programmatically is very difficult, so its not practical to specify the match we want to remove via id. Instead we need to be able to specify the match via the fqdn of the host. At present we have to manually look at the output from hammer, find the id that matches up to the fqdn we're working with, manually remove it then readd the match. That's not sustainable going forward as we migrate more of our fleet to Satellite 6 and require more complicated and frequently changing sudo rules.
+------------------------------------------------------------------------------+

Regards,

Josephine

Comment 4 Tomas Strachota 2017-06-28 08:07:40 UTC
Thank you for additional info. This is valuable feedback.

As a support for the described workflow we could also add a '--force' option to 'add-override-value' command that would replace the value if the match is found.

Comment 7 Bryan Kearney 2019-02-07 12:09:20 UTC
The Satellite Team is attempting to provide an accurate backlog of bugzilla requests which we feel will be resolved in the next few releases. We do not believe this bugzilla will meet that criteria, and have plans to close it out in 1 month. This is not a reflection on the validity of the request, but a reflection of the many priorities for the product. If you have any concerns about this, feel free to contact Red Hat Technical Support or your account team. If we do not hear from you, we will close this bug out. Thank you.

Comment 8 Bryan Kearney 2019-02-28 19:34:59 UTC
Thank you for your interest in Satellite 6. We have evaluated this request, and while we recognize that it is a valid request, we do not expect this to be implemented in the product in the foreseeable future. This is due to other priorities for the product, and not a reflection on the request itself. We are therefore closing this out as WONTFIX. If you have any concerns about this, please do not reopen. Instead, feel free to contact Red Hat Technical Support. Thank you.