summaryrefslogtreecommitdiffstats
path: root/tools/scripts
diff options
context:
space:
mode:
authorJeff Bradberry <jeff.bradberry@gmail.com>2024-04-30 16:00:18 +0200
committerJeff Bradberry <jeff.bradberry@gmail.com>2024-06-10 22:36:22 +0200
commitb69ed08fe53455de64691e61c57f30484899196e (patch)
tree665658c5f60bbb9f8a742d2d7816c1214f4072e3 /tools/scripts
parentPrint out details of all of the crosslinked roles (diff)
downloadawx-b69ed08fe53455de64691e61c57f30484899196e.tar.xz
awx-b69ed08fe53455de64691e61c57f30484899196e.zip
Specifically examine the InstanceGroup roles
Diffstat (limited to 'tools/scripts')
-rw-r--r--tools/scripts/ig-hotfix/role_check.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/tools/scripts/ig-hotfix/role_check.py b/tools/scripts/ig-hotfix/role_check.py
index 4daacafffc..6dd27d3324 100644
--- a/tools/scripts/ig-hotfix/role_check.py
+++ b/tools/scripts/ig-hotfix/role_check.py
@@ -1,11 +1,15 @@
from collections import Counter
+from awx.main.models.ha import InstanceGroup
from awx.main.models.rbac import Role
-for r in Role.objects.all():
- if not r.content_type:
- continue
- if r.id != getattr(getattr(r.content_object, r.role_field, None), 'id', None):
- rev = getattr(r.content_object, r.role_field, None)
- print(f"role.id={r.id} '{r.content_type}' id={r.object_id} field={r.role_field} | obj.roleid={getattr(rev, 'id', None)} {getattr(rev, 'content_type', None)} {getattr(rev, 'object_id', None)} {getattr(rev, 'role_field', None)}")
+for ig in InstanceGroup.objects.order_by('id'):
+ for f in ('admin_role', 'use_role', 'read_role'):
+ r = getattr(ig, f, None)
+ print(f"id={ig.id} {f} // r.id={getattr(r, 'id', None)} {getattr(r, 'content_type', None)} {getattr(r, 'object_id', None)} {getattr(r, 'role_field', None)}")
+
+
+ct = ContentType.objects.get(app_label='main', model='instancegroup')
+for r in Role.objects.filter(content_type=ct).order_by('id'):
+ print(f"id={r.id} instancegroup {r.object_id} {r.role_field}")