示例#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):
    """
    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.

    salmon 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)
示例#2
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.

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

    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)
示例#3
0
def log(port, host, pid, chdir, chroot, uid, gid, umask, force, debug, daemon):
    """
    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.
    """
    utils.start_server(pid, force, chroot, chdir, uid, gid, umask,
                       lambda: utils.make_fake_settings(host, port), debug, daemon)
示例#4
0
 def command(port,
             host,
             pid,
             chdir,
             chroot=None,
             uid=False,
             gid=False,
             umask=False,
             force=False,
             debug=False,
             daemon=True):
     loader = lambda: utils.make_fake_settings(host, port)
     utils.start_server(pid, force, chroot, chdir, uid, gid, umask, loader,
                        debug, daemon)
示例#5
0
def test_make_fake_settings():
    settings = utils.make_fake_settings('localhost', 8800)
    assert settings
    assert settings.receiver
    assert settings.relay == None
    settings.receiver.close()
示例#6
0
 def command(port, host, pid, chdir, chroot=None, uid=False, gid=False, umask=False,
             force=False, debug=False, daemon=True):
     utils.start_server(pid, force, chroot, chdir, uid, gid, umask,
                        lambda: utils.make_fake_settings(host, port), debug, daemon)
示例#7
0
def test_make_fake_settings():
    settings = utils.make_fake_settings('localhost', 8800)
    assert settings
    assert settings.receiver
    assert settings.relay is None
    settings.receiver.close()