Bug 1382356 - [RFE] Delete smart class parameter when a puppet class is deleted
Summary: [RFE] Delete smart class parameter when a puppet class is deleted
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Smart Variables
Version: 6.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: Unspecified
Assignee: orabin
QA Contact: Lukas Pramuk
URL:
Whiteboard:
: 1382677 (view as bug list)
Depends On:
Blocks: 1383386 1426394
TreeView+ depends on / blocked
 
Reported: 2016-10-06 13:09 UTC by Og Maciel
Modified: 2020-06-11 13:01 UTC (History)
12 users (show)

Fixed In Version: foreman-1.15.0-1.el7sat
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1426394 (view as bug list)
Environment:
Last Closed: 2018-02-21 12:35:52 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 17810 0 None None None 2016-12-21 10:01:32 UTC
Red Hat Product Errata RHBA-2017:1191 0 normal SHIPPED_LIVE Satellite 6.2.9 Async Bug Release 2017-05-01 17:49:42 UTC
Red Hat Product Errata RHSA-2018:0336 0 normal SHIPPED_LIVE Important: Satellite 6.3 security, bug fix, and enhancement update 2018-02-21 22:43:42 UTC

Description Og Maciel 2016-10-06 13:09:12 UTC
Description of problem:

Our automation has shown that if you import a puppet module that has smart class parameters, you will get one new entry added for the puppet module in the Class page, and 1 or more entries added to the Smart Class Parameters page.

If you delete the puppet module, the smart class parameter is not removed and is left 'orphan' in the satellite. The idea is that, if I were to re-import the same module, I may want to re-use the smart class parameters from the previous import.

Our automation imports and deletes the same puppet module hundreds of times, so the the satellite ends up accumulating several 'orphan' entries under the smart class parameters page.

I'd like to request a mechanism by which one can delete one or more smart class parameters. As a satellite admin user I'd like to be able to perform delete actions through the API, CLI (Hammer) and UI.

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


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 2 Bryan Kearney 2016-12-21 11:03:18 UTC
Upstream bug assigned to orabin@redhat.com

Comment 3 Bryan Kearney 2016-12-21 11:03:22 UTC
Upstream bug assigned to orabin@redhat.com

Comment 4 Bryan Kearney 2016-12-29 13:03:18 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/17810 has been resolved.

Comment 7 pm-sat@redhat.com 2017-02-23 21:09:37 UTC
Please add verifications steps for this bug to help QE verify

Comment 8 orabin 2017-02-26 12:05:48 UTC
Steps to verify:

1. Import any puppet class with parameters
2. Delete the puppet class and import it again
4. Check that there is only one copy of the parameter in Configure -> Smart class parameters

Expected result:
There should only be one copy of the parameter and it should also be connected to the puppet class

Comment 9 Lukas Pramuk 2017-03-28 13:23:50 UTC
VERIFIED.

Though this BZ no longer honor its title: "Need a machanism..."
With the fix you just do not need such mechanism. So not an RFE.

@satellite-6.2.9-1.0.el7sat.noarch
foreman-1.11.0.73-1.el7sat.noarch

Used manual reproducer in comment#8 with foreman_scap_client

REPRO:

# hammer -p changeme sc-param list --puppet-class foreman_scap_client
---|------------------|-----------------------------------------------------|----------|--------------------
ID | PARAMETER        | DEFAULT VALUE                                       | OVERRIDE | PUPPET CLASS       
---|------------------|-----------------------------------------------------|----------|--------------------
22 | ca_file          | ${$::foreman_scap_client::params::ca_file}          |          | foreman_scap_client
22 | ca_file          | ${$::foreman_scap_client::params::ca_file}          |          | foreman_scap_client
23 | host_certificate | ${$::foreman_scap_client::params::host_certificate} |          | foreman_scap_client
23 | host_certificate | ${$::foreman_scap_client::params::host_certificate} |          | foreman_scap_client
24 | host_private_key | ${$::foreman_scap_client::params::host_private_key} |          | foreman_scap_client
24 | host_private_key | ${$::foreman_scap_client::params::host_private_key} |          | foreman_scap_client
25 | policies         |                                                     | true     | foreman_scap_client
25 | policies         |                                                     | true     | foreman_scap_client
21 | port             |                                                     | true     | foreman_scap_client
21 | port             |                                                     | true     | foreman_scap_client
20 | server           |                                                     | true     | foreman_scap_client
20 | server           |                                                     | true     | foreman_scap_client
---|------------------|-----------------------------------------------------|----------|--------------------


vs.

FIX:

# hammer -p changeme sc-param list --puppet-class foreman_scap_client
---|------------------|-----------------------------------------------------|----------|--------------------
ID | PARAMETER        | DEFAULT VALUE                                       | OVERRIDE | PUPPET CLASS       
---|------------------|-----------------------------------------------------|----------|--------------------
22 | ca_file          | ${$::foreman_scap_client::params::ca_file}          |          | foreman_scap_client
23 | host_certificate | ${$::foreman_scap_client::params::host_certificate} |          | foreman_scap_client
24 | host_private_key | ${$::foreman_scap_client::params::host_private_key} |          | foreman_scap_client
25 | policies         |                                                     | true     | foreman_scap_client
21 | port             |                                                     | true     | foreman_scap_client
20 | server           |                                                     | true     | foreman_scap_client
---|------------------|-----------------------------------------------------|----------|--------------------

>>> with the fix you get no orphaned sc params any longer (UI/CLI)

Comment 10 Lukas Pramuk 2017-03-28 13:55:40 UTC
Also 

>>> Upgrades from 6.2.8 (where I reproduced) > 6.2.9 triggered 20161205142618_delete_orphaned_smart_class_parameters.rb and deleted orphaned params.

Comment 12 errata-xmlrpc 2017-05-01 13:55:24 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:1191

Comment 13 Karl Abbott 2017-05-02 18:44:20 UTC
Hey guys -- internal merge request 234 that was linked by Zach here rolls back the VERIFIED changes from http://projects.theforeman.org/issues/17810.

Essentially, the last change (merge request 234) completely undid this rfe and leaves Satellite 6.2.9 with no way to bulk delete smart parameters.

If we could get this addressed and pull 17810 from foreman brought back into Satellite 6.2.9 asap, that would be most appreciated.

Cheers,
Karl

Comment 14 orabin 2017-05-03 06:25:37 UTC
This RFE has changed and does not allow a bulk delete anymore, see comment 9.
The fix for 6.2.9 (https://bugzilla.redhat.com/show_bug.cgi?id=1383386) no longer shows the historical smart class parameters that are not connected to the puppet class anymore.

This RFE now deletes the smart class parameters when deleting the puppet class and will be added in 6.3.

Comment 16 Bryan Kearney 2017-06-06 12:50:36 UTC
I am cleaning up the bugs a bit which I have screwed up.

https://bugzilla.redhat.com/show_bug.cgi?id=1383386 is the small fix that should go to 6.2.z
https://bugzilla.redhat.com/show_bug.cgi?id=1382356 is the full fix.
https://bugzilla.redhat.com/show_bug.cgi?id=1426394 is the clone of the full fix and needs to be closed.

Comment 18 Ondřej Pražák 2017-08-22 07:54:18 UTC
*** Bug 1382677 has been marked as a duplicate of this bug. ***

Comment 19 Lukas Pramuk 2017-09-01 07:15:03 UTC
VERIFIED.

@satellite-6.3.0-16.0.beta.el7sat.noarch
foreman-1.15.3-2.el7sat.noarch

Used manual reproducer in comment#8 with foreman_scap_client

1. Import puppet classes esp. foreman_scap_client

# hammer sc-param list --puppet-class foreman_scap_client
---|----------------------|-----------------------------------------------------|----------|--------------------
ID | PARAMETER            | DEFAULT VALUE                                       | OVERRIDE | PUPPET CLASS       
---|----------------------|-----------------------------------------------------|----------|--------------------
42 | ca_file              | ${$::foreman_scap_client::params::ca_file}          |          | foreman_scap_client
41 | ensure               | present                                             |          | foreman_scap_client
48 | foreman_repo_gpg_chk |                                                     |          | foreman_scap_client
46 | foreman_repo_key     | https://yum.theforeman.org/RPM-GPG-KEY-foreman      |          | foreman_scap_client
45 | foreman_repo_rel     |                                                     |          | foreman_scap_client
47 | foreman_repo_src     |                                                     |          | foreman_scap_client
43 | host_certificate     | ${$::foreman_scap_client::params::host_certificate} |          | foreman_scap_client
44 | host_private_key     | ${$::foreman_scap_client::params::host_private_key} |          | foreman_scap_client
40 | policies             |                                                     | true     | foreman_scap_client
39 | port                 |                                                     | true     | foreman_scap_client
38 | server               |                                                     | true     | foreman_scap_client
---|----------------------|-----------------------------------------------------|----------|--------------------

2. Delete foreman_scap_client puppet class

3. Import foreman_scap_client puppet class again

4. Check that there is only one copy of the parameter in Configure -> Smart class parameters:
foreman_scap_client

# hammer sc-param list --puppet-class foreman_scap_client
---|----------------------|-----------------------------------------------------|----------|--------------------
ID | PARAMETER            | DEFAULT VALUE                                       | OVERRIDE | PUPPET CLASS       
---|----------------------|-----------------------------------------------------|----------|--------------------
53 | ca_file              | ${$::foreman_scap_client::params::ca_file}          |          | foreman_scap_client
52 | ensure               | present                                             |          | foreman_scap_client
59 | foreman_repo_gpg_chk |                                                     |          | foreman_scap_client
57 | foreman_repo_key     | https://yum.theforeman.org/RPM-GPG-KEY-foreman      |          | foreman_scap_client
56 | foreman_repo_rel     |                                                     |          | foreman_scap_client
58 | foreman_repo_src     |                                                     |          | foreman_scap_client
54 | host_certificate     | ${$::foreman_scap_client::params::host_certificate} |          | foreman_scap_client
55 | host_private_key     | ${$::foreman_scap_client::params::host_private_key} |          | foreman_scap_client
51 | policies             |                                                     | true     | foreman_scap_client
50 | port                 |                                                     | true     | foreman_scap_client
49 | server               |                                                     | true     | foreman_scap_client
---|----------------------|-----------------------------------------------------|----------|--------------------

>>> parameters were deleted with class deletion as there is no duplicity in respective params and also their ids are different after re-import

Comment 22 errata-xmlrpc 2018-02-21 12:35:52 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2018:0336


Note You need to log in before you can comment on or make changes to this bug.