From f3a0974313cff295f1ab2d9f868441fa5fce83e0 Mon Sep 17 00:00:00 2001 From: mprahl Date: Nov 21 2019 16:38:23 +0000 Subject: Support running the find_images_to_rebuild.py script using a virtualenv The logging change is necessary since the fedmsg logging configuration will not have the default `formatters` and `handlers` set. If these aren't set, the script fails when configuring logging since there is no `console` handler. --- diff --git a/dev_scripts/find_images_to_rebuild.py b/dev_scripts/find_images_to_rebuild.py index dd44210..f7e3abf 100755 --- a/dev_scripts/find_images_to_rebuild.py +++ b/dev_scripts/find_images_to_rebuild.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python from __future__ import print_function import os import sys @@ -13,6 +13,7 @@ sys.path.insert(1, os.path.join(sys.path[0], '..')) # Set the FRESHMAKER_DEVELOPER_ENV variable. os.environ["FRESHMAKER_DEVELOPER_ENV"] = "1" os.environ["FRESHMAKER_CONFIG_FILE"] = os.path.join(sys.path[0], "config.py") +os.environ["REQUESTS_CA_BUNDLE"] = "/etc/ssl/certs/ca-bundle.crt" from freshmaker import db, app from freshmaker.errata import Errata, ErrataAdvisory diff --git a/fedmsg.d/freshmaker-logging.py b/fedmsg.d/freshmaker-logging.py index 40454ab..60c9bf9 100644 --- a/fedmsg.d/freshmaker-logging.py +++ b/fedmsg.d/freshmaker-logging.py @@ -1,5 +1,19 @@ config = dict( logging=dict( + handlers={ + 'console': { + 'class': 'logging.StreamHandler', + 'formatter': 'bare', + 'level': 'INFO', + 'stream': 'ext://sys.stdout', + }, + }, + formatters={ + 'bare': { + 'datefmt': '%Y-%m-%d %H:%M:%S', + 'format': '[%(asctime)s][%(name)10s %(levelname)7s] %(message)s', + }, + }, loggers=dict( # Quiet these guys down... requests={ @@ -28,5 +42,6 @@ config = dict( # "handlers": ["console"], # }, ), + version=1, ), )