Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backup hotfix script #15260

Merged
merged 36 commits into from
Jun 10, 2024
Merged

Backup hotfix script #15260

merged 36 commits into from
Jun 10, 2024

Conversation

jbradberry
Copy link
Contributor

@jbradberry jbradberry commented Jun 7, 2024

SUMMARY

This PR moves the hotfix script for the backup/restore Role cross-linking problem into AWX.

The role_check.py script has already been used by several customers.

Also, QE is working on a pipeline that makes use of it in testing. @jay-steurer

ISSUE TYPE
  • Bug, Docs Fix or other nominal change
COMPONENT NAME
  • API

This version emits the first fix-up script as its output.
Also, attempt to rebuild the role ancestors in the fixup script.
… ones

Also, null out the generic foreign key on orphaned roles before deleting.
The underlying role should be re-linked, instead of treated as orphaned.
Apparently this has happened to a customer, per Nate Becker.
Doing the entire graph is too much on any system with real amounts of Roles.
…there

This is actually happening for one customer, though it seems like it
shouldn't be if the foreign key constraint is set back up properly.
In order to recreate it, I had to add the constraint back with 'NOT
VALID' added on to prevent the check.
Checking if parents and implicit_parents are consistent with ancestors.
This version, however, has false positives because Roles become
children of Team.member_role when a Role is granted to a Team.
The results in my test now look correct.
…ssible

since the foreign keys to the roles from the resources can make us go
wrong almost immediately.
I think that rebuild_role_ancestor_list() will then correctly update
all of the affected Role.ancestors.
it wound up being unworkable, and I think ultimately we only need to
check the immediate parentage of each role.
Also, make use of up-front defined arrays of the tables involved, for
ease of editing in the future.
Some relationships known to be handled by the special mapping sql file
were being caught as false positives.
Since we use it twice, the second time to get the id field of each.
@jbradberry jbradberry self-assigned this Jun 7, 2024
@jbradberry jbradberry merged commit aadcc21 into ansible:devel Jun 10, 2024
22 checks passed
@jbradberry jbradberry deleted the backup-hotfix branch June 10, 2024 20:36
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.

2 participants