Example #1
0
def log_command(port=8825,
                host='127.0.0.1',
                chroot=False,
                chdir=".",
                uid=False,
                gid=False,
                umask=False,
                pid="./run/log.pid",
                FORCE=False,
                debug=False,
                daemon=True):
    """
    Runs a logging only server on the given hosts and port.  It logs
    each message it receives and also stores it to the run/queue 
    so that you can make sure it was received in testing.

    lamson log -port 8825 -host 127.0.0.1 \\
            -pid ./run/log.pid -chroot False  \\
            -chdir "." -umask False -uid False -gid False \\
            -FORCE False

    If you specify a uid/gid then this means you want to first change to
    root, set everything up, and then drop to that UID/GID combination.
    This is typically so you can bind to port 25 and then become "safe"
    to continue operating as a non-root user.

    If you give one or the other, this it will just change to that
    uid or gid without doing the priv drop operation.
    """
    loader = lambda: utils.make_fake_settings(host, port)
    utils.start_server(pid, FORCE, chroot, chdir, uid, gid, umask, loader,
                       debug, daemon)
Example #2
0
def start_command(pid='./run/smtp.pid', FORCE=False, chroot=False, chdir=".",
                  boot="config.boot", uid=False, gid=False, umask=False, debug=False):
    """
    Runs a lamson server out of the current directory:

    lamson start -pid ./run/smtp.pid -FORCE False -chroot False -chdir "." \\
            -umask False -uid False -gid False -boot config.boot
    """
    loader = lambda: utils.import_settings(True, from_dir=os.getcwd(), boot_module=boot)
    utils.start_server(pid, FORCE, chroot, chdir, uid, gid, umask, loader, debug)
Example #3
0
def start_command(pid='./run/smtp.pid', FORCE=False, chroot=False, chdir=".",
                  boot="config.boot", uid=False, gid=False, umask=False, debug=False):
    """
    Runs a lamson server out of the current directory:

    lamson start -pid ./run/smtp.pid -FORCE False -chroot False -chdir "." \\
            -umask False -uid False -gid False -boot config.boot
    """
    loader = lambda: utils.import_settings(True, from_dir=os.getcwd(), boot_module=boot)
    utils.start_server(pid, FORCE, chroot, chdir, uid, gid, umask, loader, debug)
Example #4
0
 def handle(self, *args, **options):
     #version 1.2 does not exists?
     if LAMSON_VERSION['version'] < '1.2':
         lamson_utils.start_server(options['pid'], options['force'],
                                   options['chroot'], options['chdir'],
                                   options['uid'], options['gid'],
                                   options['umask'], _settings_loader)
     else:
         lamson_utils.start_server(options['pid'], options['force'],
                                   options['chroot'], options['chdir'],
                                   options['uid'], options['gid'],
                                   options['umask'], _settings_loader,
                                   django_settings.DEBUG)
Example #5
0
 def handle(self, *args, **options):
     #version 1.2 does not exists?
     if LAMSON_VERSION['version'] < '1.2':
         lamson_utils.start_server(options['pid'],
                                 options['force'],
                                 options['chroot'],
                                 options['chdir'],
                                 options['uid'],
                                 options['gid'],
                                 options['umask'],
                                 _settings_loader)
     else:
         lamson_utils.start_server(options['pid'],
                                 options['force'],
                                 options['chroot'],
                                 options['chdir'],
                                 options['uid'],
                                 options['gid'],
                                 options['umask'],
                                 _settings_loader,
                                 django_settings.DEBUG)
Example #6
0
def log_command(port=8825, host='127.0.0.1', chroot=False,
                chdir=".", uid=False, gid=False, umask=False, pid="./run/log.pid",
               FORCE=False, debug=False):
    """
    Runs a logging only server on the given hosts and port.  It logs
    each message it receives and also stores it to the run/queue 
    so that you can make sure it was received in testing.

    lamson log -port 8825 -host 127.0.0.1 \\
            -pid ./run/log.pid -chroot False  \\
            -chdir "." -umask False -uid False -gid False \\
            -FORCE False

    If you specify a uid/gid then this means you want to first change to
    root, set everything up, and then drop to that UID/GID combination.
    This is typically so you can bind to port 25 and then become "safe"
    to continue operating as a non-root user.

    If you give one or the other, this it will just change to that
    uid or gid without doing the priv drop operation.
    """
    loader = lambda: utils.make_fake_settings(host, port)
    utils.start_server(pid, FORCE, chroot, chdir, uid, gid, umask, loader, debug)