diff --git a/lifecycle/wait_for_db.py b/lifecycle/wait_for_db.py index b7e5e41e1..8898920e6 100755 --- a/lifecycle/wait_for_db.py +++ b/lifecycle/wait_for_db.py @@ -1,16 +1,28 @@ #!/usr/bin/env python """This file needs to be run from the root of the project to correctly import passbook. This is done by the dockerfile.""" +from json import dumps +from sys import stderr from time import sleep from psycopg2 import OperationalError, connect from redis import Redis from redis.exceptions import RedisError -from structlog import get_logger from passbook.lib.config import CONFIG -LOGGER = get_logger() + +def j_print(event: str, log_level: str = "info", **kwargs): + """Print event in the same format as structlog with JSON. + Used before structlog is configured.""" + data = { + "event": event, + "level": log_level, + "logger": __name__, + } + data.update(**kwargs) + print(dumps(data), file=stderr) + while True: try: @@ -24,7 +36,7 @@ while True: break except OperationalError: sleep(1) - LOGGER.warning("PostgreSQL Connection failed, retrying...") + j_print("PostgreSQL Connection failed, retrying...") while True: try: @@ -38,4 +50,4 @@ while True: break except RedisError: sleep(1) - LOGGER.warning("Redis Connection failed, retrying...") + j_print("Redis Connection failed, retrying...") diff --git a/passbook/providers/oauth2/migrations/0005_auto_20200920_1240.py b/passbook/providers/oauth2/migrations/0005_auto_20200920_1240.py new file mode 100644 index 000000000..106585abf --- /dev/null +++ b/passbook/providers/oauth2/migrations/0005_auto_20200920_1240.py @@ -0,0 +1,36 @@ +# Generated by Django 3.1.1 on 2020-09-20 12:40 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ( + "passbook_providers_oauth2", + "0004_remove_oauth2provider_post_logout_redirect_uris", + ), + ] + + operations = [ + migrations.AlterField( + model_name="oauth2provider", + name="response_type", + field=models.TextField( + choices=[ + ("code", "code (Authorization Code Flow)"), + ( + "code#adfs", + "code (ADFS Compatibility Mode, sends id_token as access_token)", + ), + ("id_token", "id_token (Implicit Flow)"), + ("id_token token", "id_token token (Implicit Flow)"), + ("code token", "code token (Hybrid Flow)"), + ("code id_token", "code id_token (Hybrid Flow)"), + ("code id_token token", "code id_token token (Hybrid Flow)"), + ], + default="code", + help_text="Response Type required by the client.", + ), + ), + ]