mirror of
https://github.com/ansible/awx.git
synced 2026-02-28 08:18:43 -03:30
hop node migration file updates(#14196)
rename migration function set_peers_from_control_nodes_true to automatically_peer_from_control_plane import settings and only run function if settings.IS_K8S is true set listener_port for control nodes to None
This commit is contained in:
@@ -2,11 +2,14 @@
|
|||||||
|
|
||||||
import django.core.validators
|
import django.core.validators
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
|
||||||
def set_peers_from_control_nodes_true(apps, schema_editor):
|
def automatically_peer_from_control_plane(apps, schema_editor):
|
||||||
Instance = apps.get_model('main', 'Instance')
|
if settings.IS_K8S:
|
||||||
Instance.objects.filter(node_type='execution').update(peers_from_control_nodes=True)
|
Instance = apps.get_model('main', 'Instance')
|
||||||
|
Instance.objects.filter(node_type='execution').update(peers_from_control_nodes=True)
|
||||||
|
Instance.objects.filter(node_type='control').update(listener_port=None)
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
@@ -49,5 +52,5 @@ class Migration(migrations.Migration):
|
|||||||
validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(65535)],
|
validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(65535)],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
migrations.RunPython(set_peers_from_control_nodes_true),
|
migrations.RunPython(automatically_peer_from_control_plane),
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user