mirror of
https://github.com/ansible/awx.git
synced 2026-01-14 11:20:39 -03:30
set default uuid
This commit is contained in:
parent
f02099e8b7
commit
262cd3c695
@ -115,8 +115,6 @@ class InstanceManager(models.Manager):
|
||||
raise RuntimeError("No instance found with the current cluster host id")
|
||||
|
||||
def register(self, uuid=None, hostname=None, ip_address=None, node_type='hybrid', defaults=None):
|
||||
if not uuid:
|
||||
uuid = str(uuid4())
|
||||
if not hostname:
|
||||
hostname = settings.CLUSTER_HOST_ID
|
||||
with advisory_lock('instance_registration_%s' % hostname):
|
||||
@ -149,7 +147,7 @@ class InstanceManager(models.Manager):
|
||||
return (False, instance)
|
||||
|
||||
# Create new instance, and fill in default values
|
||||
create_defaults = dict(capacity=0, uuid=uuid)
|
||||
create_defaults = dict(capacity=0)
|
||||
if defaults is not None:
|
||||
create_defaults.update(defaults)
|
||||
if node_type == 'execution' and 'version' not in create_defaults:
|
||||
|
||||
18
awx/main/migrations/0154_set_default_uuid.py
Normal file
18
awx/main/migrations/0154_set_default_uuid.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Generated by Django 2.2.20 on 2021-09-01 22:53
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('main', '0153_instance_last_seen'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='instance',
|
||||
name='uuid',
|
||||
field=models.CharField(default='00000000-0000-0000-0000-000000000000', max_length=40),
|
||||
),
|
||||
]
|
||||
@ -59,7 +59,7 @@ class Instance(HasPolicyEditsMixin, BaseModel):
|
||||
objects = InstanceManager()
|
||||
|
||||
# Fields set in instance registration
|
||||
uuid = models.CharField(max_length=40)
|
||||
uuid = models.CharField(max_length=40, default='00000000-0000-0000-0000-000000000000')
|
||||
hostname = models.CharField(max_length=250, unique=True)
|
||||
ip_address = models.CharField(
|
||||
blank=True,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user