-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Backup hotfix script #15260
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
of the Role relationships.
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.
to trigger the implicit parent not being in the parents and ancestors lists.
when doing the final reset of Role.implicit_parents.
fosterseth
approved these changes
Jun 7, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
COMPONENT NAME