Files
wireguard_webadmin/cluster/management/commands/primary_wireguard_enabled.py
T

12 lines
459 B
Python
Raw Normal View History

from django.core.management.base import BaseCommand, CommandError
from cluster.models import ClusterSettings
class Command(BaseCommand):
help = 'Exit with status 1 when WireGuard is disabled on the primary server in the cluster settings'
def handle(self, *args, **options):
if not ClusterSettings.primary_serves_clients():
raise CommandError('WireGuard is disabled on the primary server in the cluster settings', returncode=1)