diff options
author | Jeff Bradberry <jeff.bradberry@gmail.com> | 2024-05-06 16:31:17 +0200 |
---|---|---|
committer | Jeff Bradberry <jeff.bradberry@gmail.com> | 2024-06-10 22:36:22 +0200 |
commit | 0e87e97820166e4442d66e6ca8825c1403f73e18 (patch) | |
tree | 1e1214670549129ae3bbce3d0536df649cc12a3c /tools | |
parent | Make the role_chain.py script emit a Graphviz file (diff) | |
download | awx-0e87e97820166e4442d66e6ca8825c1403f73e18.tar.xz awx-0e87e97820166e4442d66e6ca8825c1403f73e18.zip |
Check for a broken ContentType -> model and log and skip
Apparently this has happened to a customer, per Nate Becker.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/scripts/ig-hotfix/role_check.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/scripts/ig-hotfix/role_check.py b/tools/scripts/ig-hotfix/role_check.py index f5d902340f..ec8511dfd9 100644 --- a/tools/scripts/ig-hotfix/role_check.py +++ b/tools/scripts/ig-hotfix/role_check.py @@ -13,6 +13,9 @@ orphaned_roles = [] for ct in ContentType.objects.order_by('id'): cls = ct.model_class() + if cls is None: + sys.stderr.write(f"{ct!r} does not have a corresponding model class in the codebase. Skipping.\n") + continue if not any(isinstance(f, ImplicitRoleField) for f in cls._meta.fields): continue for obj in cls.objects.all(): |