diff options
author | Jeff Bradberry <jeff.bradberry@gmail.com> | 2024-06-04 15:34:50 +0200 |
---|---|---|
committer | Jeff Bradberry <jeff.bradberry@gmail.com> | 2024-06-10 22:36:22 +0200 |
commit | 345c1c11e986941ac5ec53592b0727302370ed5a (patch) | |
tree | 6a0a92564a4f330d46c627350524dbb8041a6541 /tools/scripts | |
parent | Add a new test scenario (diff) | |
download | awx-345c1c11e986941ac5ec53592b0727302370ed5a.tar.xz awx-345c1c11e986941ac5ec53592b0727302370ed5a.zip |
Guard against the role field not being populated
when doing the final reset of Role.implicit_parents.
Diffstat (limited to 'tools/scripts')
-rw-r--r-- | tools/scripts/ig-hotfix/role_check.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/scripts/ig-hotfix/role_check.py b/tools/scripts/ig-hotfix/role_check.py index 3cc1b7933b..ef2e67b9c0 100644 --- a/tools/scripts/ig-hotfix/role_check.py +++ b/tools/scripts/ig-hotfix/role_check.py @@ -180,6 +180,7 @@ print(" role_fields = [f for f in cls._meta.fields if isinstance(f, ImplicitR print(" obj = cls.objects.get(id=obj_id)") print(" for f in role_fields:") print(" r = getattr(obj, f.name, None)") -print(" r.implicit_parents = '[]'") -print(" r.save()") +print(" if r is not None:") +print(" r.implicit_parents = '[]'") +print(" r.save()") print(" obj.save()") |