Exemple #1
0
def send_notifications(people, pushtype, pushurl):
    pushmanager_servername = Settings['main_app']['servername']
    pushmanager_servername = pushmanager_servername.rstrip('/')
    pushmanager_port = ':%d' % Settings['main_app']['port'] if Settings[
        'main_app']['port'] != 443 else ''

    pushurl = pushurl.lstrip('/')
    pushmanager_url = "https://%s/%s" % (pushmanager_servername +
                                         pushmanager_port, pushurl)

    if people:
        msg = '%s: %s push starting! %s' % (', '.join(people), pushtype,
                                            pushmanager_url)
        XMPPQueue.enqueue_user_xmpp(people,
                                    'Push starting! %s' % pushmanager_url)
    elif pushtype == 'morning':
        msg = 'Morning push opened. %s' % pushmanager_servername
    else:
        msg = 'push starting. %s' % pushmanager_url

    subprocess.call([
        '/nail/sys/bin/nodebot', '-i', Settings['irc']['nickname'],
        Settings['irc']['channel'], msg
    ])

    subject = "New push notification"
    MailQueue.enqueue_user_email(Settings['mail']['notifyall'], msg, subject)
    def on_db_complete(self, success, db_results):
        self.check_db_results(success, db_results)

        _, staged_requests, push_result = db_results
        push = push_result.fetchone()

        for req in staged_requests:
            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 deployed request for %(user)s to %(pushstage)s:
                </p>
                <p>
                    <strong>%(user)s - %(title)s</strong><br />
                    <em>%(repo)s/%(branch)s</em>
                </p>
                <p>
                    Once you've checked that it works, mark it as verified here:
                    <a href="https://%(pushmanager_servername)s%(pushmanager_port)s/push?id=%(pushid)s">
                        https://%(pushmanager_servername)s%(pushmanager_port)s/push?id=%(pushid)s
                    </a>
                </p>
                <p>
                    Regards,<br />
                    PushManager
                </p>"""
                ) % pushmanager.core.util.EscapedDict({
                    'pushmaster': self.current_user,
                    'pushmanager_servername': Settings['main_app']['servername'],
                    'pushmanager_port' : ':%d' % Settings['main_app']['port'] if Settings['main_app']['port'] != 443 else '',
                    'user': user_string,
                    'title': req['title'],
                    'repo': req['repo'],
                    'branch': req['branch'],
                    'pushid': self.pushid,
                    'pushstage': push['stageenv'],
                })
            subject = "[push] %s - %s" % (user_string, req['title'])
            MailQueue.enqueue_user_email(users, msg, subject)

            msg = '%(pushmaster)s has deployed request "%(title)s" for %(user)s to %(pushstage)s.\nPlease verify it at https://%(pushmanager_servername)s%(pushmanager_port)s/push?id=%(pushid)s' % {
                    'pushmaster': self.current_user,
                    'pushmanager_servername': Settings['main_app']['servername'],
                    'pushmanager_port': ':%d' % Settings['main_app']['port'] if Settings['main_app']['port'] != 443 else '',
                    'title': req['title'],
                    'pushid': self.pushid,
                    'user': user_string,
                    'pushstage': push['stageenv'],
                }
            XMPPQueue.enqueue_user_xmpp(users, msg)

        if push['extra_pings']:
            for user in push['extra_pings'].split(','):
                XMPPQueue.enqueue_user_xmpp([user], '%s has deployed a push to stage.' % self.current_user)
Exemple #3
0
def send_notifications(people, pushtype, pushmanager_url):
    pushmanager_servername = Settings['main_app']['servername']

    if people:
        msg = '%s: %s push starting! %s' % (', '.join(people), pushtype, pushmanager_url)
        XMPPQueue.enqueue_user_xmpp(people, 'Push starting! %s' % pushmanager_url)
    elif pushtype == 'morning':
        msg = 'Morning push opened. %s' % pushmanager_servername
    else:
        msg = 'push starting. %s' % pushmanager_url

    if people:
        send_people_msg_in_groups(
            people, "%s push starting! %s" % (pushtype, pushmanager_url),
            Settings['irc']['nickname'], Settings['irc']['channel'],
            person_per_group=5, prefix_msg=''
        )
    else:
        subprocess.call([
            '/nail/sys/bin/nodebot',
            '-i',
            Settings['irc']['nickname'],
            Settings['irc']['channel'],
            msg
        ])

    subject = "New push notification"
    MailQueue.enqueue_user_email(Settings['mail']['notifyall'], msg, subject)
def send_notifications(people, pushtype, pushurl):
    pushmanager_servername = Settings['main_app']['servername']
    pushmanager_servername = pushmanager_servername.rstrip('/')
    pushmanager_port = ':%d' % Settings['main_app']['port'] if Settings['main_app']['port'] != 443 else ''

    pushurl = pushurl.lstrip('/')
    pushmanager_url = "https://%s/%s" % (pushmanager_servername + pushmanager_port, pushurl)

    if people:
        msg = '%s: %s push starting! %s' % (', '.join(people), pushtype, pushmanager_url)
        XMPPQueue.enqueue_user_xmpp(people, 'Push starting! %s' % pushmanager_url)
    elif pushtype == 'morning':
        msg = 'Morning push opened. %s' % pushmanager_servername
    else:
        msg = 'push starting. %s' % pushmanager_url

    subprocess.call([
        '/nail/sys/bin/nodebot',
        '-i',
        Settings['irc']['nickname'],
        Settings['irc']['channel'],
        msg
    ])

    subject = "New push notification"
    MailQueue.enqueue_user_email(Settings['mail']['notifyall'], msg, subject)
Exemple #5
0
    def on_db_complete(self, success, db_results):
        self.check_db_results(success, db_results)

        _, staged_requests, push_result = db_results
        push = push_result.fetchone()

        for req in staged_requests:
            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 deployed request for %(user)s to %(pushstage)s:
                </p>
                <p>
                    <strong>%(user)s - %(title)s</strong><br />
                    <em>%(repo)s/%(branch)s</em>
                </p>
                <p>
                    Once you've checked that it works, mark it as verified here:
                    <a href="%(pushmanager_base_url)s/push?id=%(pushid)s">
                        %(pushmanager_base_url)s/push?id=%(pushid)s
                    </a>
                </p>
                <p>
                    Regards,<br />
                    PushManager
                </p>""") % pushmanager.core.util.EscapedDict(
                {
                    'pushmaster': self.current_user,
                    'pushmanager_base_url': self.get_base_url(),
                    'user': user_string,
                    'title': req['title'],
                    'repo': req['repo'],
                    'branch': req['branch'],
                    'pushid': self.pushid,
                    'pushstage': push['stageenv'],
                })
            subject = "[push] %s - %s" % (user_string, req['title'])
            MailQueue.enqueue_user_email(users, msg, subject)

            msg = '{0} has deployed request "{1}" for {2} to {3}.\nPlease verify it at {4}/push?id={5}'.format(
                self.current_user,
                req['title'],
                user_string,
                push['stageenv'],
                self.get_base_url(),
                self.pushid,
            )
            XMPPQueue.enqueue_user_xmpp(users, msg)

        if push['extra_pings']:
            for user in push['extra_pings'].split(','):
                XMPPQueue.enqueue_user_xmpp(
                    [user],
                    '%s has deployed a push to stage.' % self.current_user)
Exemple #6
0
    def on_db_complete(self, success, db_results):
        self.check_db_results(success, db_results)

        _, staged_requests, push_result = db_results
        push = push_result.fetchone()

        for req in staged_requests:
            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 deployed request for %(user)s to %(pushstage)s:
                </p>
                <p>
                    <strong>%(user)s - %(title)s</strong><br />
                    <em>%(repo)s/%(branch)s</em>
                </p>
                <p>
                    Once you've checked that it works, mark it as verified here:
                    <a href="%(pushmanager_base_url)s/push?id=%(pushid)s">
                        %(pushmanager_base_url)s/push?id=%(pushid)s
                    </a>
                </p>
                <p>
                    Regards,<br />
                    PushManager
                </p>"""
                ) % pushmanager.core.util.EscapedDict({
                    'pushmaster': self.current_user,
                    'pushmanager_base_url': self.get_base_url(),
                    'user': user_string,
                    'title': req['title'],
                    'repo': req['repo'],
                    'branch': req['branch'],
                    'pushid': self.pushid,
                    'pushstage': push['stageenv'],
                })
            subject = "[push] %s - %s" % (user_string, req['title'])
            MailQueue.enqueue_user_email(users, msg, subject)

            msg = '{0} has deployed request "{1}" for {2} to {3}.\nPlease verify it at {4}/push?id={5}'.format(
                self.current_user,
                req['title'],
                user_string,
                push['stageenv'],
                self.get_base_url(),
                self.pushid,
            )
            XMPPQueue.enqueue_user_xmpp(users, msg)

        if push['extra_pings']:
            for user in push['extra_pings'].split(','):
                XMPPQueue.enqueue_user_xmpp([user], '%s has deployed a push to stage.' % self.current_user)
Exemple #7
0
    def on_db_complete(self, success, db_results):
        self.check_db_results(success, db_results)

        reqs, _, _ = db_results
        removal_dicts = []
        for req in reqs:
            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 removed request for %(user)s from a push:
                </p>
                <p>
                    <strong>%(user)s - %(title)s</strong><br />
                    <em>%(repo)s/%(branch)s</em>
                </p>
                <p>
                    Regards,<br />
                    PushManager
                </p>""") % pushmanager.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)
            msg = '%(pushmaster)s has removed request "%(title)s" for %(user)s from a push' % {
                'pushmaster': self.current_user,
                'title': req['title'],
                'pushid': self.pushid,
                'user': user_string,
            }
            XMPPQueue.enqueue_user_xmpp(users, msg)
            removal_dicts.append({
                'request': req['id'],
                'push': self.pushid,
                'reason': 'removal after %s' % req['state'],
                'pushmaster': self._current_user,
                'timestamp': int(time.time()),
            })

        removal_queries = [
            db.push_removals.insert(removal) for removal in removal_dicts
        ]
        db.execute_transaction_cb(removal_queries, self.on_db_insert_complete)
    def on_db_complete(self, success, db_results):
        self.check_db_results(success, db_results)

        reqs, _, _ = db_results
        removal_dicts = []
        for req in reqs:
            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 removed request for %(user)s from a push:
                </p>
                <p>
                    <strong>%(user)s - %(title)s</strong><br />
                    <em>%(repo)s/%(branch)s</em>
                </p>
                <p>
                    Regards,<br />
                    PushManager
                </p>"""
                ) % pushmanager.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)
            msg = '%(pushmaster)s has removed request "%(title)s" for %(user)s from a push' % {
                    'pushmaster': self.current_user,
                    'title': req['title'],
                    'pushid': self.pushid,
                    'user': user_string,
                }
            XMPPQueue.enqueue_user_xmpp(users, msg)
            removal_dicts.append({
                'request': req['id'],
                'push': self.pushid,
                'reason': 'removal after %s' % req['state'],
                'pushmaster': self._current_user,
                'timestamp': int(time.time()),
            })

        removal_queries = [db.push_removals.insert(removal) for removal in removal_dicts]
        db.execute_transaction_cb(removal_queries, self.on_db_insert_complete)
Exemple #9
0
    def on_db_complete(self, success, db_results):
        self.check_db_results(success, db_results)

        _, blessed_requests, push_results = db_results
        for req in blessed_requests:
            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 deployed request for %(user)s to production:
                </p>
                <p>
                    <strong>%(user)s - %(title)s</strong><br />
                    <em>%(repo)s/%(branch)s</em>
                </p>
                <p>
                    Regards,<br />
                    PushManager
                </p>""") % pushmanager.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)
            msg = '%(pushmaster)s has deployed request "%(title)s" for %(user)s to production.' % {
                'pushmaster': self.current_user,
                'title': req['title'],
                'user': user_string,
            }
            XMPPQueue.enqueue_user_xmpp(users, msg)

        push = push_results.fetchone()
        if push['extra_pings']:
            for user in push['extra_pings'].split(','):
                XMPPQueue.enqueue_user_xmpp(
                    [user], '%s has deployed a push to production.' %
                    self.current_user)

        self.finish()
Exemple #10
0
    def on_db_complete(self, success, db_results):
        self.check_db_results(success, db_results)

        for req in db_results[-1]:
            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 accepted request for %(user)s into a push:
                </p>
                <p>
                    <strong>%(user)s - %(title)s</strong><br />
                    <em>%(repo)s/%(branch)s</em>
                </p>
                <p>
                    Regards,<br />
                    PushManager
                </p>""") % pushmanager.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)
            msg = '%(pushmaster)s has accepted request "%(title)s" for %(user)s into a push:\nhttps://%(pushmanager_servername)s%(pushmanager_port)s/push?id=%(pushid)s' % {
                'pushmanager_servername':
                Settings['main_app']['servername'],
                'pushmanager_port':
                ':%d' % Settings['main_app']['port']
                if Settings['main_app']['port'] != 443 else '',
                'pushmaster':
                self.current_user,
                'title':
                req['title'],
                'pushid':
                self.pushid,
                'user':
                user_string,
            }
            XMPPQueue.enqueue_user_xmpp(users, msg)
    def on_db_complete(self, success, db_results):
        self.check_db_results(success, db_results)

        _, blessed_requests, push_results = db_results
        for req in blessed_requests:
            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 deployed request for %(user)s to production:
                </p>
                <p>
                    <strong>%(user)s - %(title)s</strong><br />
                    <em>%(repo)s/%(branch)s</em>
                </p>
                <p>
                    Regards,<br />
                    PushManager
                </p>"""
                ) % pushmanager.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)
            msg = '%(pushmaster)s has deployed request "%(title)s" for %(user)s to production.' % {
                    'pushmaster': self.current_user,
                    'title': req['title'],
                    'user': user_string,
                }
            XMPPQueue.enqueue_user_xmpp(users, msg)

        push = push_results.fetchone()
        if push['extra_pings']:
            for user in push['extra_pings'].split(','):
                XMPPQueue.enqueue_user_xmpp([user], '%s has deployed a push to production.' % self.current_user)

        self.finish()
    def on_db_complete(self, success, db_results):
        self.check_db_results(success, db_results)

        _, req = db_results
        req = req.first()
        if req["state"] != "discarded":
            # We didn't actually discard the record, for whatever reason
            return self.redirect("/requests?user=%s" % self.current_user)

        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>
                Request for %(user)s has been discarded:
            </p>
            <p>
                <strong>%(user)s - %(title)s</strong><br />
                <em>%(repo)s/%(branch)s</em>
            </p>
            <p>
                Regards,<br />
                PushManager
            </p>"""
            )
            % pushmanager.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)

        self.redirect("/requests?user=%s" % self.current_user)
Exemple #13
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>"""
                )
                % pushmanager.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)
    def on_db_complete(self, success, db_results):
        self.check_db_results(success, db_results)

        for req in db_results[-1]:
            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 accepted request for %(user)s into a push:
                </p>
                <p>
                    <strong>%(user)s - %(title)s</strong><br />
                    <em>%(repo)s/%(branch)s</em>
                </p>
                <p>
                    Regards,<br />
                    PushManager
                </p>"""
                ) % pushmanager.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)
            msg = '%(pushmaster)s has accepted request "%(title)s" for %(user)s into a push:\nhttps://%(pushmanager_servername)s%(pushmanager_port)s/push?id=%(pushid)s' % {
                'pushmanager_servername': Settings['main_app']['servername'],
                'pushmanager_port': ':%d' % Settings['main_app']['port'] if Settings['main_app']['port'] != 443 else '',
                'pushmaster': self.current_user,
                'title': req['title'],
                'pushid': self.pushid,
                'user': user_string,
            }
            XMPPQueue.enqueue_user_xmpp(users, msg)
Exemple #15
0
    def on_db_complete(self, success, db_results):
        self.check_db_results(success, db_results)

        _, _, req = db_results
        req = req.first()
        if req['state'] != 'delayed':
            # We didn't actually discard the record, for whatever reason
            return self.redirect("/requests?user=%s" % self.current_user)

        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>
                Request for %(user)s has been marked as delayed
                by %(pushmaster)s, and will not be accepted into
                pushes until you mark it as requested again:
            </p>
            <p>
                <strong>%(user)s - %(title)s</strong><br />
                <em>%(repo)s/%(branch)s</em>
            </p>
            <p>
                Regards,<br />
                PushManager
            </p>"""
            ) % pushmanager.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)

        self.redirect("/requests?user=%s" % self.current_user)
Exemple #16
0
    def on_db_complete(self, success, db_results):
        self.check_db_results(success, db_results)

        for req in db_results[-1]:
            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 accepted request for %(user)s into a push:
                </p>
                <p>
                    <strong>%(user)s - %(title)s</strong><br />
                    <em>%(repo)s/%(branch)s</em>
                </p>
                <p>
                    Regards,<br />
                    PushManager
                </p>"""
                ) % pushmanager.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)
            msg = '{0} has accepted request "{1}" for {2} into a push:\n{3}/push?id={4}'.format(
                self.current_user,
                req['title'],
                user_string,
                self.get_base_url(),
                self.pushid,
            )
            XMPPQueue.enqueue_user_xmpp(users, msg)
Exemple #17
0
    def on_db_complete(self, success, db_results):
        self.check_db_results(success, db_results)

        _, _, req = db_results
        req = req.first()
        if req['state'] != 'delayed':
            # We didn't actually discard the record, for whatever reason
            return self.redirect("/requests?user=%s" % self.current_user)

        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>
                Request for %(user)s has been marked as delayed by %(pushmaster)s, and will not be accepted into pushes until you
                mark it as requested again:
            </p>
            <p>
                <strong>%(user)s - %(title)s</strong><br />
                <em>%(repo)s/%(branch)s</em>
            </p>
            <p>
                Regards,<br />
                PushManager
            </p>"""
            ) % pushmanager.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)

        self.redirect("/requests?user=%s" % self.current_user)
Exemple #18
0
    def on_db_complete(self, success, db_results):
        self.check_db_results(success, db_results)

        if db_results:
            req = db_results[1].first()
            msg = (
                """
                <p>
                    %(pushmaster)s has commented on your request:
                </p>
                <p>
                    <strong>%(user)s - %(title)s</strong><br />
                    <em>%(repo)s/%(branch)s</em>
                </p>
                <pre>
%(comment)s
                </pre>
                <p>
                    Regards,<br />
                    PushManager
                </p>"""
            ) % pushmanager.core.util.EscapedDict({
                    'pushmaster': self.current_user,
                    'user': req['user'],
                    'title': req['title'],
                    'repo': req['repo'],
                    'branch': req['branch'],
                    'comment': self.comment,
                })
            subject = "[push comment] %s - %s" % (req['user'], req['title'])
            MailQueue.enqueue_user_email([req['user']], msg, subject)
            msg = '%(pushmaster)s has commented on your request "%(title)s":\n%(comment)s' % {
                    'pushmaster': self.current_user,
                    'title': req['title'],
                    'comment': self.comment,
                }
            XMPPQueue.enqueue_user_xmpp([req['user']], msg)
            newcomments = req[db.push_requests.c.comments]
            self.write(xhtml_escape(newcomments))
Exemple #19
0
    def on_db_complete(self, success, db_results):
        self.check_db_results(success, db_results)

        for req in db_results[-1]:
            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 accepted request for %(user)s into a push:
                </p>
                <p>
                    <strong>%(user)s - %(title)s</strong><br />
                    <em>%(repo)s/%(branch)s</em>
                </p>
                <p>
                    Regards,<br />
                    PushManager
                </p>""") % pushmanager.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)
            msg = '{0} has accepted request "{1}" for {2} into a push:\n{3}/push?id={4}'.format(
                self.current_user,
                req['title'],
                user_string,
                self.get_base_url(),
                self.pushid,
            )
            XMPPQueue.enqueue_user_xmpp(users, msg)
Exemple #20
0
    def on_db_complete(self, success, db_results):
        self.check_db_results(success, db_results)

        if db_results:
            req = db_results[1].first()
            msg = (
                """
                <p>
                    %(pushmaster)s has commented on your request:
                </p>
                <p>
                    <strong>%(user)s - %(title)s</strong><br />
                    <em>%(repo)s/%(branch)s</em>
                </p>
                <pre>
%(comment)s
                </pre>
                <p>
                    Regards,<br />
                    PushManager
                </p>"""
            ) % pushmanager.core.util.EscapedDict({
                    'pushmaster': self.current_user,
                    'user': req['user'],
                    'title': req['title'],
                    'repo': req['repo'],
                    'branch': req['branch'],
                    'comment': self.comment,
                })
            subject = "[push comment] %s - %s" % (req['user'], req['title'])
            MailQueue.enqueue_user_email([req['user']], msg, subject)
            msg = '%(pushmaster)s has commented on your request "%(title)s":\n%(comment)s' % {
                    'pushmaster': self.current_user,
                    'title': req['title'],
                    'comment': self.comment,
                }
            XMPPQueue.enqueue_user_xmpp([req['user']], msg)
            newcomments = req[db.push_requests.c.comments]
            self.write(xhtml_escape(newcomments))
Exemple #21
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>"""
                ) % pushmanager.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)
    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>"""
                ) % pushmanager.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)
Exemple #23
0
    def on_db_complete(self, success, db_results):
        self.check_db_results(success, db_results)

        _, staged_requests, push_result = db_results
        push = push_result.fetchone()

        for req in staged_requests:
            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 deployed request for %(user)s to %(pushstage)s:
                </p>
                <p>
                    <strong>%(user)s - %(title)s</strong><br />
                    <em>%(repo)s/%(branch)s</em>
                </p>
                <p>
                    Once you've checked that it works, mark it as verified here:
                    <a href="https://%(pushmanager_servername)s%(pushmanager_port)s/push?id=%(pushid)s">
                        https://%(pushmanager_servername)s%(pushmanager_port)s/push?id=%(pushid)s
                    </a>
                </p>
                <p>
                    Regards,<br />
                    PushManager
                </p>""") % pushmanager.core.util.EscapedDict({
                'pushmaster':
                self.current_user,
                'pushmanager_servername':
                Settings['main_app']['servername'],
                'pushmanager_port':
                ':%d' % Settings['main_app']['port']
                if Settings['main_app']['port'] != 443 else '',
                'user':
                user_string,
                'title':
                req['title'],
                'repo':
                req['repo'],
                'branch':
                req['branch'],
                'pushid':
                self.pushid,
                'pushstage':
                push['stageenv'],
            })
            subject = "[push] %s - %s" % (user_string, req['title'])
            MailQueue.enqueue_user_email(users, msg, subject)

            msg = '%(pushmaster)s has deployed request "%(title)s" for %(user)s to %(pushstage)s.\nPlease verify it at https://%(pushmanager_servername)s%(pushmanager_port)s/push?id=%(pushid)s' % {
                'pushmaster':
                self.current_user,
                'pushmanager_servername':
                Settings['main_app']['servername'],
                'pushmanager_port':
                ':%d' % Settings['main_app']['port']
                if Settings['main_app']['port'] != 443 else '',
                'title':
                req['title'],
                'pushid':
                self.pushid,
                'user':
                user_string,
                'pushstage':
                push['stageenv'],
            }
            XMPPQueue.enqueue_user_xmpp(users, msg)

        if push['extra_pings']:
            for user in push['extra_pings'].split(','):
                XMPPQueue.enqueue_user_xmpp(
                    [user],
                    '%s has deployed a push to stage.' % self.current_user)