Skip to content

Conversation

@Gauravtalreja1
Copy link
Contributor

Problem Statement

The CheckCorruptedRoles checks fails to run on latest Foreman. It attempts to select and insert into filters.override or first.override. This column has been removed from the database schema in theforeman/foreman#10370, but not sure why it started to fail in our tests now.

Solution

Removed all references to the override column in the SQL queries (both the selection logic and the record creation logic).

Testing

  1. Validated that the filters table does not contain the override column in the database.
  2. Create any corrupted role and run following command to validate
# foreman-maintain health check --label corrupted-roles

Signed-off-by: Gaurav Talreja <gtalreja@redhat.com>
Copy link
Contributor

@adamruzicka adamruzicka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look sane and it seems to do the trick

Copy link
Member

@evgeni evgeni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rubygem-foreman_maintain-1.13.6-1.el9.noarch.rpm from nightly:

[root@centos9-stream-foreman-nightly ~]# foreman-maintain health check --label corrupted-roles
Running ForemanMaintain::Scenario::FilteredScenario
================================================================================
Check for roles that have filters with multiple resources attached:   [FAIL]
There are filters having permissions with multiple resource types. Roles with such filters are:

--------------------------------------------------------------------------------
Continue with step [Create additional filters so that each filter has only permissions of one resource]?, [y(yes), n(no)] n
Scenario [ForemanMaintain::Scenario::FilteredScenario] failed.                  

The following steps ended up in failing state:

  [corrupted-roles]

Resolve the failed steps and rerun the command.
In case the failures are false positives, use
--whitelist="corrupted-roles"

rubygem-foreman_maintain-1:1.13.6-1.20251121162028560985.pr1064.4.g7174b38.el9.noarch from Packit:

[root@centos9-stream-foreman-nightly ~]# foreman-maintain health check --label corrupted-roles
Running ForemanMaintain::Scenario::FilteredScenario
================================================================================
Check for roles that have filters with multiple resources attached:   [OK]
--------------------------------------------------------------------------------

@evgeni evgeni merged commit 1fe2abb into theforeman:master Nov 24, 2025
8 checks passed
@Gauravtalreja1 Gauravtalreja1 deleted the fix-corrupted-roles-check branch November 24, 2025 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants