Bug 1417994 - Unable to remove cloned built-in roles (6.2 backport)
Summary: Unable to remove cloned built-in roles (6.2 backport)
Status: CLOSED DUPLICATE of bug 1378544
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Users & Roles
Version: 6.2.1
Hardware: Unspecified
OS: Unspecified
Target Milestone: Unspecified
Assignee: Swapnil Abnave
QA Contact: Katello QA List
Depends On: 1378544 1426672
TreeView+ depends on / blocked
Reported: 2017-01-31 14:46 UTC by Lukas Zapletal
Modified: 2020-03-11 15:42 UTC (History)
18 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1378544
Last Closed: 2017-02-24 19:07:04 UTC
Target Upstream Version:

Attachments (Terms of Use)
Hotfix tarball (4.07 KB, application/x-gzip)
2017-01-31 14:55 UTC, Lukas Zapletal
no flags Details
Hotfix - updated version (5.07 KB, application/x-gzip)
2017-02-24 13:31 UTC, Lukas Zapletal
no flags Details

System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 16828 0 None None None 2017-01-31 14:46:14 UTC

Description Lukas Zapletal 2017-01-31 14:46:14 UTC
+++ This bug was initially created as a clone of Bug #1378544 +++

Description of problem:
Unable to remove cloned built-in roles

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


Comment 4 Lukas Zapletal 2017-01-31 14:55:55 UTC
Created attachment 1246320 [details]
Hotfix tarball

I am attaching a hotfix that will prevent from incorrect cloned roles, please apply it:

[root@amd-ma78gm-01 hotfix]# ./satellite-hotfix 1378544
Applying 1378544: Cloned roles cannot be deleted
Applying 1378544: file 1378544-builtin-role.patch
patch -fup1 --verbose -d /usr/share/foreman -r /root/hotfix/backups/1485874196-1378544/1378544.rej -b -B /root/hotfix/backups/1485874196-1378544/ < /root/hotfix/patches/1378544-builtin-role.patch
Please restart httpd service, other services do not need to be restarted:
  systemctl restart httpd
Also please run the following command to fix existing (cloned) roles:
  echo "Role.where(:builtin => nil).update_all(:builtin => 0)" | foreman-rake console
SUCCESS! Backup files are in /root/hotfix/backups

Then please run this command to fix all existing roles:

#  echo "Role.where(:builtin => nil).update_all(:builtin => 0)" | foreman-rake console

And afterwards you should be able to edit/delete those roles.

Comment 5 pm-sat@redhat.com 2017-01-31 15:16:01 UTC
Upstream bug assigned to sabnave@redhat.com

Comment 6 pm-sat@redhat.com 2017-01-31 15:16:07 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/16828 has been resolved.

Comment 8 Lukas Zapletal 2017-02-15 13:27:07 UTC
Can we get QAck? This missed 6.2.8 errata, hopefully this will be in the next one. it is oneliner backport.

Comment 12 Lukas Zapletal 2017-02-24 13:31:20 UTC
Created attachment 1257215 [details]
Hotfix - updated version

Usage (tarball extraction):

  tar -xzf satellite-hotfix-20170101-abcdef1.tar.gz
  cd satellite-hotfix-20170101-abcdef1

Usage (dry run):

  ./satellite-hotfix -n 1234567


  ./satellite-hotfix 1234567

Revert a hotfix:

  ./satellite-hotfix -r 1234567

List all available hotfixes:


The numbers are real Red Hat Bugzilla numbers. All backup and reject files are
save in backups/ sub-directory. Please keep the tarball for possible reverting
of the change in the future. If patching fails, revert immediately and report
the output. After each Satellite update, this hotfix process must be repeated
if the updated does not include the bugfix yet, search in errata notes for
bugzilla numbers to confirm. Hotfixes are distributed in tarballs with date
timestamps, new tarball obsoletes the old one and includes all previous

If system-wide Ruby is not installed for some reason, use Satellite Foreman
Ruby software collection:

  scl enable rh-ruby22 -- ./satellite-hotfix -h

To find out Ruby versions available do:

  ls /opt/*/*ruby* -d

Comment 13 Bryan Kearney 2017-02-24 19:07:04 UTC
closing this out as a duplicate of 1378544

*** This bug has been marked as a duplicate of bug 1378544 ***

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