mirror of
https://github.com/ansible/awx.git
synced 2026-05-10 02:47:36 -02:30
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:
@@ -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)
|
||||
]
|
||||
Reference in New Issue
Block a user