Exemplo n.º 1
0
def main():
    """Entry point for bitsd."""
    enable_pretty_logging()

    try:
        parse_config_file('/etc/bitsd.conf')
    except IOError:
        LOG.warning('Config file not found, using defaults and command line.')

    try:
        parse_command_line()
    except tornado.options.Error as error:
        sys.stderr.write('{}\n'.format(error))
        sys.exit(0)

    persistence.start()
    server.start()
    listener.start()

    # Add signal handlers...
    signal.signal(signal.SIGTERM, sig_handler)
    signal.signal(signal.SIGINT, sig_handler)

    if not options.log_requests:
        logging.getLogger("tornado.access").setLevel(logging.WARNING)

    tornado.ioloop.IOLoop.instance().start()
Exemplo n.º 2
0
def main():
    """Entry point for bitsd."""
    enable_pretty_logging()

    try:
        parse_config_file('/etc/bitsd.conf')
    except IOError:
        LOG.warning('Config file not found, using defaults and command line.')

    try:
        parse_command_line()
    except tornado.options.Error as error:
        sys.stderr.write('{}\n'.format(error))
        sys.exit(0)

    persistence.start()
    server.start()
    listener.start()

    # Add signal handlers...
    signal.signal(signal.SIGTERM, sig_handler)
    signal.signal(signal.SIGINT, sig_handler)

    if not options.log_requests:
        logging.getLogger("tornado.access").setLevel(logging.WARNING)

    tornado.ioloop.IOLoop.instance().start()
Exemplo n.º 3
0

import sys
from getpass import getpass


if __name__ == '__main__':
    try:
        parse_config_file('/etc/bitsd.conf')
    except IOError:
        print ("[INFO] No /etc/bitsd.conf found, ignoring.")

    action = sys.argv[1]
    username = sys.argv[2]

    start()

    with session_scope() as session:
        if action == 'add':
            password = getpass('Password for `{}`:'.format(username))
            useradd(session, username, password)
        elif action == 'delete':
            userdel(session, username)
        elif action == 'modify':
            password = getpass('New password for `{}`:'.format(username))
            usermod(session, username, password)
        else:
            sys.stderr.write(
                "Usage: {} add|delete|modify <username>\n".format(sys.argv[0])
            )
            sys.exit(1)
Exemplo n.º 4
0
# Copyright (C) 2013 Stefano Sanfilippo
# Copyright (C) 2013 BITS development team
#
# This file is part of bitsd, which is released under the terms of
# GNU GPLv3. See COPYING at top level for more information.
#
"""
Fill Database with Markdown pages.
"""

# DO NOT REMOVE
import bitsd.properties

from bitsd.persistence import start
from bitsd.persistence.models import Page
from bitsd.persistence.engine import persist, session_scope
from tornado.options import parse_config_file

if __name__ == '__main__':
    try:
        parse_config_file('/etc/bitsd.conf')
    except IOError:
        print("No /etc/bitsd.conf found, ignoring.")

    start()

    with open('INFO.md', 'r') as info:
        infopage = Page('Info', info.read().decode('utf-8'))
        with session_scope() as session:
            persist(session, infopage)