Generate new uuid for newly registered iso nodes

When provisioning a new isolated node, generate a new uuid instead of
reusing the SYSTEM_UUID of the controller node.
This commit is contained in:
Jake McDermott
2020-01-03 11:45:25 -05:00
parent 0bbf5e4faf
commit d91e72c23f
2 changed files with 32 additions and 1 deletions

View File

@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
from uuid import uuid4
from django.db import migrations
from awx.main.models import Instance
def _generate_new_uuid_for_iso_nodes(apps, schema_editor):
for instance in Instance.objects.all():
if instance.is_isolated():
instance.uuid = str(uuid4())
instance.save()
class Migration(migrations.Migration):
dependencies = [
('main', '0100_v370_projectupdate_job_tags'),
]
operations = [
migrations.RunPython(_generate_new_uuid_for_iso_nodes)
]