From c18346ed5f8356f1e8b70c7b35cafaf3fb4c4c59 Mon Sep 17 00:00:00 2001 From: Lukas Holecek Date: Feb 26 2020 16:53:33 +0000 Subject: Fix default subject_types configuration path Default configuration path for subject_types in message consumers is invalid because subject_types directory is not installed in /usr/lib*. The fix is to use environment variable GREENWAVE_SUBJECT_TYPES_DIR which defaults to "/src/conf/subject_types" in the container. Signed-off-by: Lukas Holecek --- diff --git a/Dockerfile b/Dockerfile index 8e96e23..ba3a0eb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,6 +31,7 @@ RUN if [ "$cacert_url" != "undefined" ]; then \ # This will allow a non-root user to install a custom root CA at run-time RUN chmod 777 /etc/pki/tls/certs/ca-bundle.crt COPY . . +ENV GREENWAVE_SUBJECT_TYPES_DIR /src/conf/subject_types RUN pip3 install . --no-deps # Remove the default fedmsg config files included in the repo RUN rm -rf ./fedmsg.d diff --git a/greenwave/utils.py b/greenwave/utils.py index 00ee7ad..c4aae65 100644 --- a/greenwave/utils.py +++ b/greenwave/utils.py @@ -98,6 +98,9 @@ def load_config(config_obj=None): if os.environ.get('SECRET_KEY'): config['SECRET_KEY'] = os.environ['SECRET_KEY'] + if os.environ.get('GREENWAVE_SUBJECT_TYPES_DIR'): + config['SUBJECT_TYPES_DIR'] = os.environ['GREENWAVE_SUBJECT_TYPES_DIR'] + return config diff --git a/setup.py b/setup.py index 81a57a3..e487ae8 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- # SPDX-License-Identifier: GPL-2.0+ -import glob import os import re from setuptools import setup, find_packages @@ -101,6 +100,5 @@ setup( """, data_files=[ ('/etc/fedmsg.d/', ['fedmsg.d/resultsdb.py', 'fedmsg.d/waiverdb.py']), - ('conf/subject_types/', glob.glob('conf/subject_types/*')), ] )