Exemplo n.º 1
0
def destalinate_job():
    print("Destalinating")
    if "SB_TOKEN" not in os.environ or "API_TOKEN" not in os.environ:
        print("ERR: Missing at least one Slack environment variable.")
    else:
        scheduled_warner = warner.Warner()
        scheduled_archiver = archiver.Archiver()
        scheduled_announcer = announcer.Announcer()
        scheduled_flagger = flagger.Flagger()
        print("Warning")
        scheduled_warner.warn()
        print("Archiving")
        scheduled_archiver.archive()
        print("Announcing")
        scheduled_announcer.announce()
        print("Flagging")
        scheduled_flagger.flag()
        print("OK: destalinated")
    print("END: destalinate_job")
Exemplo n.º 2
0
def destalinate_job():
    logging.info("Destalinating")
    if not _config.sb_token or not _config.api_token:
        logging.error(
            "Missing at least one required Slack environment variable.\n"
            "Make sure to set DESTALINATOR_SB_TOKEN and DESTALINATOR_API_TOKEN."
        )
    else:
        try:
            archiver.Archiver().archive()
            warner.Warner().warn()
            announcer.Announcer().announce()
            flagger.Flagger().flag()
            logging.info("OK: destalinated")
        except Exception as e:  # pylint: disable=W0703
            raven_client.captureException()
            if not _config.sentry_dsn:
                raise e
    logging.info("END: destalinate_job")
Exemplo n.º 3
0
def destalinate_job():
    print("Destalinating")
    if "SB_TOKEN" not in os.environ or "API_TOKEN" not in os.environ:
        print("ERR: Missing at least one Slack environment variable.")
    else:
        try:
            scheduled_warner = warner.Warner()
            scheduled_archiver = archiver.Archiver()
            scheduled_announcer = announcer.Announcer()
            scheduled_flagger = flagger.Flagger()
            print("Warning")
            scheduled_warner.warn()
            print("Archiving")
            scheduled_archiver.archive()
            print("Announcing")
            scheduled_announcer.announce()
            print("Flagging")
            scheduled_flagger.flag()
            print("OK: destalinated")
        except Exception as e:  # pylint: disable=W0703
            raven_client.captureException()
            if not os.getenv('SENTRY_DSN'):
                raise e
    print("END: destalinate_job")
Exemplo n.º 4
0
#! /usr/bin/env python

import warner
import archiver

import json

if __name__ == "__main__":
    warn_and_archive_warner = warner.Warner()
    warn_and_archive_archiver = archiver.Archiver()
    warn_and_archive_warner.warn()
    warn_and_archive_archiver.archive()