Ejemplo n.º 1
0
    def start_services(self):
        # HTTPS server
        sockets = tornado.netutil.bind_sockets(self.port, address=Settings["main_app"]["servername"])
        redir_sockets = tornado.netutil.bind_sockets(self.redir_port, address=Settings["main_app"]["servername"])
        tornado.process.fork_processes(0)

        server = tornado.httpserver.HTTPServer(
            self.main_app,
            ssl_options={
                "certfile": Settings["main_app"]["ssl_certfile"],
                # This really should be read into a string so we can drop privileges
                # after reading the key but before starting the server, but Python
                # doesn't let us use strings for keys until Python 3.2 :(
                "keyfile": Settings["main_app"]["ssl_keyfile"],
            },
        )
        server.add_sockets(sockets)

        # HTTP server (to redirect to HTTPS)
        redir_server = tornado.httpserver.HTTPServer(self.redir_app)
        redir_server.add_sockets(redir_sockets)

        # Start the mail, git, reviewboard and XMPP queue handlers
        MailQueue.start_worker()
        GitQueue.start_worker()
        RBQueue.start_worker()
        XMPPQueue.start_worker()
Ejemplo n.º 2
0
    def start_services(self):
        # HTTPS server
        sockets = tornado.netutil.bind_sockets(
            self.port, address=Settings['main_app']['servername'])
        redir_sockets = tornado.netutil.bind_sockets(
            self.redir_port, address=Settings['main_app']['servername'])
        tornado.process.fork_processes(0)

        server = tornado.httpserver.HTTPServer(
            self.main_app,
            ssl_options={
                'certfile': Settings['main_app']['ssl_certfile'],
                # This really should be read into a string so we can drop privileges
                # after reading the key but before starting the server, but Python
                # doesn't let us use strings for keys until Python 3.2 :(
                'keyfile': Settings['main_app']['ssl_keyfile'],
            })
        server.add_sockets(sockets)

        # HTTP server (to redirect to HTTPS)
        redir_server = tornado.httpserver.HTTPServer(self.redir_app)
        redir_server.add_sockets(redir_sockets)

        # Start the mail, git, reviewboard and XMPP queue handlers
        MailQueue.start_worker()
        GitQueue.start_worker()
        RBQueue.start_worker()
        XMPPQueue.start_worker()
Ejemplo n.º 3
0
    def on_db_complete(self, success, db_results):
        self.check_db_results(success, db_results)

        _, _, _, _, live_requests = db_results
        for req in live_requests:
            if req['reviewid']:
                review_id = int(req['reviewid'])
                RBQueue.enqueue_review(review_id)

            if req['watchers']:
                user_string = '%s (%s)' % (req['user'], req['watchers'])
                users = [req['user']] + req['watchers'].split(',')
            else:
                user_string = req['user']
                users = [req['user']]

            msg = (
                """
                <p>
                    %(pushmaster)s has certified request for %(user)s as stable in production:
                </p>
                <p>
                    <strong>%(user)s - %(title)s</strong><br />
                    <em>%(repo)s/%(branch)s</em>
                </p>
                <p>
                    Regards,<br />
                    PushManager
                </p>"""
                ) % core.util.EscapedDict({
                    'pushmaster': self.current_user,
                    'user': user_string,
                    'title': req['title'],
                    'repo': req['repo'],
                    'branch': req['branch'],
                })
            subject = "[push] %s - %s" % (user_string, req['title'])
            MailQueue.enqueue_user_email(users, msg, subject)
Ejemplo n.º 4
0
    def on_db_complete(self, success, db_results):
        self.check_db_results(success, db_results)

        _, _, _, _, live_requests = db_results
        for req in live_requests:
            if req["reviewid"]:
                review_id = int(req["reviewid"])
                RBQueue.enqueue_review(review_id)

            msg = (
                (
                    """
                <p>
                    %(pushmaster)s has certified your request as stable in production:
                </p>
                <p>
                    <strong>%(user)s - %(title)s</strong><br />
                    <em>%(repo)s/%(branch)s</em>
                </p>
                <p>
                    Regards,<br />
                    PushManager
                </p>"""
                )
                % core.util.EscapedDict(
                    {
                        "pushmaster": self.current_user,
                        "user": req["user"],
                        "title": req["title"],
                        "repo": req["repo"],
                        "branch": req["branch"],
                    }
                )
            )
            subject = "[push] %s - %s" % (req["user"], req["title"])
            MailQueue.enqueue_user_email([req["user"]], msg, subject)
Ejemplo n.º 5
0
    def on_db_complete(self, success, db_results):
        self.check_db_results(success, db_results)

        _, _, _, _, live_requests = db_results
        for req in live_requests:
            if req['reviewid']:
                review_id = int(req['reviewid'])
                RBQueue.enqueue_review(review_id)

            if req['watchers']:
                user_string = '%s (%s)' % (req['user'], req['watchers'])
                users = [req['user']] + req['watchers'].split(',')
            else:
                user_string = req['user']
                users = [req['user']]

            msg = ("""
                <p>
                    %(pushmaster)s has certified request for %(user)s as stable in production:
                </p>
                <p>
                    <strong>%(user)s - %(title)s</strong><br />
                    <em>%(repo)s/%(branch)s</em>
                </p>
                <p>
                    Regards,<br />
                    PushManager
                </p>""") % core.util.EscapedDict({
                'pushmaster': self.current_user,
                'user': user_string,
                'title': req['title'],
                'repo': req['repo'],
                'branch': req['branch'],
            })
            subject = "[push] %s - %s" % (user_string, req['title'])
            MailQueue.enqueue_user_email(users, msg, subject)