From 621b053435bf9f039991ae039951d5e9669ddb2e Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Mar 06 2018 17:46:34 +0000 Subject: Some debugging. --- diff --git a/greenwave/consumers/resultsdb.py b/greenwave/consumers/resultsdb.py index d7b747e..314e416 100644 --- a/greenwave/consumers/resultsdb.py +++ b/greenwave/consumers/resultsdb.py @@ -111,6 +111,8 @@ class ResultsDBHandler(fedmsg.consumers.FedmsgConsumer): for rule in policy.rules: if rule.test_case_name == testcase: applicable_policies.add(policy) + log.debug("messaging: found %i applicable policies of %i for testcase %r" % ( + len(applicable_policies), len(config['policies']), testcase)) # Given all of our applicable policies, build a map of all decision # context we know about, and which product versions they relate to. @@ -118,6 +120,7 @@ class ResultsDBHandler(fedmsg.consumers.FedmsgConsumer): for policy in applicable_policies: versions = set(policy.product_versions) decision_contexts[policy.decision_context].update(versions) + log.debug("messaging: found %i decision contexts" % len(decision_contexts)) # For every context X version combination, ask greenwave if this new # result pushes any decisions over a threshold. diff --git a/greenwave/utils.py b/greenwave/utils.py index db6d792..d480051 100644 --- a/greenwave/utils.py +++ b/greenwave/utils.py @@ -1,14 +1,18 @@ # SPDX-License-Identifier: GPL-2.0+ import functools -import os import glob +import logging +import os + import yaml from flask import jsonify, current_app, request from flask.config import Config from werkzeug.exceptions import HTTPException from greenwave.policies import Policy, Rule +log = logging.getLogger(__name__) + def json_error(error): """ @@ -72,12 +76,19 @@ def load_config(config_obj=None): else: default_config_file = '/etc/greenwave/settings.py' + log.debug("config: Loading config from %r" % config_obj) config.from_object(config_obj) + config_file = os.environ.get('GREENWAVE_CONFIG', default_config_file) + log.debug("config: Extending config with %r" % config_file) config.from_pyfile(config_file) + if os.environ.get('SECRET_KEY'): config['SECRET_KEY'] = os.environ['SECRET_KEY'] + + log.debug("config: Loading policies from %r" % config['POLICIES_DIR']) config['policies'] = load_policies(config['POLICIES_DIR']) + return config