mirror of
https://github.com/ansible/awx.git
synced 2026-03-18 09:27:31 -02:30
Set up Seth's bad role scenario
This commit is contained in:
19
tools/scripts/ig-hotfix/test.py
Normal file
19
tools/scripts/ig-hotfix/test.py
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
from django.db import connection
|
||||||
|
from awx.main.models import InstanceGroup
|
||||||
|
|
||||||
|
InstanceGroup.objects.filter(name__in=('green', 'yellow', 'red')).delete()
|
||||||
|
|
||||||
|
green = InstanceGroup.objects.create(name='green')
|
||||||
|
red = InstanceGroup.objects.create(name='red')
|
||||||
|
yellow = InstanceGroup.objects.create(name='yellow')
|
||||||
|
|
||||||
|
for ig in InstanceGroup.objects.all():
|
||||||
|
print((ig.id, ig.name, ig.use_role_id))
|
||||||
|
|
||||||
|
with connection.cursor() as cursor:
|
||||||
|
cursor.execute("UPDATE main_instancegroup SET use_role_id = NULL WHERE name = 'red'")
|
||||||
|
cursor.execute(f"UPDATE main_instancegroup SET use_role_id = {green.use_role_id} WHERE name = 'yellow'")
|
||||||
|
|
||||||
|
print("=====================================")
|
||||||
|
for ig in InstanceGroup.objects.all():
|
||||||
|
print((ig.id, ig.name, ig.use_role_id))
|
||||||
Reference in New Issue
Block a user