update cluster settings to enforce WireGuard requirements during test phase

This commit is contained in:
Eduardo Silva
2026-01-01 10:55:23 -03:00
parent b7065177a7
commit 18acdf0f09
3 changed files with 28 additions and 1 deletions

View File

@@ -141,6 +141,7 @@ class ClusterSettingsForm(forms.ModelForm):
cleaned_data = super().clean()
stats_sync_interval = cleaned_data.get('stats_sync_interval')
stats_cache_interval = cleaned_data.get('stats_cache_interval')
primary_enable_wireguard = cleaned_data.get('primary_enable_wireguard')
if stats_sync_interval and stats_sync_interval < 60:
raise ValidationError(_("Stats sync interval must be at least 60 seconds."))
@@ -148,4 +149,7 @@ class ClusterSettingsForm(forms.ModelForm):
if stats_cache_interval and stats_cache_interval < 60:
raise ValidationError(_("Stats cache interval must be at least 60 seconds."))
if not primary_enable_wireguard:
raise ValidationError(_("Disabling WireGuard on the master server is currently not supported."))
return cleaned_data

View File

@@ -0,0 +1,23 @@
# Generated by Django 5.2.9 on 2026-01-01 13:54
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cluster', '0012_remove_workerstatus_config_pending'),
]
operations = [
migrations.AlterField(
model_name='clustersettings',
name='restart_mode',
field=models.CharField(choices=[('auto', 'Automatic restart')], default='auto', max_length=16),
),
migrations.AlterField(
model_name='worker',
name='error_status',
field=models.CharField(choices=[('', ''), ('ip_lock', 'IP lock is enabled, but the worker is attempting to access from a different IP address.'), ('worker_disabled', 'Worker is not enabled'), ('cluster_disabled', 'Cluster is not enabled'), ('missing_version', 'Please report worker_config_version, worker_dns_version and worker_version in the API request.'), ('update_required', 'Worker update is required.')], default='', max_length=32),
),
]

View File

@@ -11,7 +11,7 @@ class ClusterSettings(models.Model):
stats_sync_interval = models.IntegerField(default=60)
stats_cache_interval = models.IntegerField(default=60)
cluster_mode = models.CharField(default='mirror', max_length=16, choices=(('mirror', 'Mirror'), ))
restart_mode = models.CharField(default='auto', max_length=16, choices=(('auto', 'Automatically restart/reload'), ('manual', 'Manual')))
restart_mode = models.CharField(default='auto', max_length=16, choices=(('auto', 'Automatic restart'),))
worker_display = models.CharField(
default='server_address', max_length=16, choices=(
('name', 'Name'), ('server_address', 'Server Address'),