Bug 1884024

Summary: Red Hat Satellite upgrade to 6.6 fails if duplicate permissions are present in foreman database
Product: Red Hat Satellite Reporter: James Jeffers <jjeffers>
Component: Satellite MaintainAssignee: Suraj Patil <supatil>
Status: CLOSED ERRATA QA Contact: Jameer Pathan <jpathan>
Severity: unspecified Docs Contact:
Priority: high    
Version: 6.6.0CC: ahumbe, amarirom, apatel, bbuckingham, bkearney, gtalreja, jjeffers, jpasqual, kagarwal, kgaikwad, ktordeur, pcreech, rankumar, sperezto, supatil, zhunting
Target Milestone: 6.8.1Keywords: PrioBumpGSS, Triaged, Upgrades, UserExperience
Target Release: Unused   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1849110 Environment:
Last Closed: 2020-11-23 17:13:53 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Comment 1 Bryan Kearney 2020-09-30 20:05:20 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/30527 has been resolved.

Comment 2 Jameer Pathan 2020-11-05 12:09:50 UTC
Verified:

Verified with:
- Satellite 6.8.1 snap 1
- rubygem-foreman_maintain-0.6.13-1.el7sat.noarch

Test steps:
- Create a role. 
- Create filters 
- Create duplicate permissions and add duplicate permissions to filters.
- Run pre-upgrade check "foreman-maintain health check --label duplicate_permissions"

Observation:
- foreman-maintain check duplicate_permissions deleted duplicate permissions.
- duplicate_permissions check is added to pre-upgrade checks list.

[root@hpe-dl380egen8-01 ~]# foreman-maintain health check --label duplicate_permissions
Running ForemanMaintain::Scenario::FilteredScenario
================================================================================
Check for duplicate permissions from database:                        [FAIL]
Duplicate permissions in your database
--------------------------------------------------------------------------------
Continue with step [Remove duplicate permissions from database]?, [y(yes), n(no), q(quit)] y
Remove duplicate permissions from database:                           [OK]      
--------------------------------------------------------------------------------
Rerunning the check after fix procedure
Check for duplicate permissions from database:                        [OK]
--------------------------------------------------------------------------------

[root@hpe-dl380egen8-01 ~]# foreman-maintain health check --label duplicate_permissions
Running ForemanMaintain::Scenario::FilteredScenario
================================================================================
Check for duplicate permissions from database:                        [OK]
--------------------------------------------------------------------------------

Creating duplicate permissions:
[root@dell-r430-20 ~]# sudo su - postgres
-bash-4.2$ psql foreman
psql (9.2.24)
Type "help" for help.

foreman=# INSERT INTO permissions (name, resource_type) VALUES ('edit_ansible_variables', 'AnsibleVariable');
INSERT 0 1
foreman=# INSERT INTO permissions (name, resource_type) VALUES ('view_ansible_roles', 'AnsibleRole');
INSERT 0 1

Comment 7 errata-xmlrpc 2020-11-23 17:13:53 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 (Satellite 6.8.1 Async Bug Fix Update), 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-2020:5180