From c5b52f110ed497350e0acb85ae765d6c3065e760 Mon Sep 17 00:00:00 2001 From: Clement Verna Date: Apr 03 2019 11:55:55 +0000 Subject: Move GREENWAVE_API_URL to the config.py. This commit move the GREENWAVE_API_URL to config.py instead of being in the fedmsg config. This is needed for the consumers to work when using fedora-messaging. Signed-off-by: Clement Verna --- diff --git a/fedmsg.d/config.py b/fedmsg.d/config.py index 664262d..6f159bc 100644 --- a/fedmsg.d/config.py +++ b/fedmsg.d/config.py @@ -126,7 +126,4 @@ config = dict( # but whose cert names aren't in the associated list are dropped; messages # whose topics do not appear in the routing_policy are not dropped. routing_nitpicky=False, - - # Greenwave API url - greenwave_api_url='https://greenwave.domain.local/api/v1.0', ) diff --git a/greenwave/config.py b/greenwave/config.py index 1ea8026..a01140b 100644 --- a/greenwave/config.py +++ b/greenwave/config.py @@ -35,6 +35,8 @@ class Config(object): # By default, don't cache anything. CACHE = {'backend': 'dogpile.cache.null'} + # Greenwave API url + GREENWAVE_API_URL = 'https://greenwave.domain.local/api/v1.0' class ProductionConfig(Config): diff --git a/greenwave/consumers/resultsdb.py b/greenwave/consumers/resultsdb.py index 66b7e6d..0e2afaf 100644 --- a/greenwave/consumers/resultsdb.py +++ b/greenwave/consumers/resultsdb.py @@ -274,7 +274,7 @@ class ResultsDBHandler(fedmsg.consumers.FedmsgConsumer): log.info('Getting greenwave info') for decision_context, product_version in sorted(contexts_product_versions): - greenwave_url = self.fedmsg_config['greenwave_api_url'] + '/decision' + greenwave_url = current_app.config['GREENWAVE_API_URL'] + '/decision' data = { 'decision_context': decision_context, diff --git a/greenwave/consumers/waiverdb.py b/greenwave/consumers/waiverdb.py index b36644a..1fa1e57 100644 --- a/greenwave/consumers/waiverdb.py +++ b/greenwave/consumers/waiverdb.py @@ -12,6 +12,7 @@ to the message bus about the newly satisfied/unsatisfied policy. import logging import json +from flask import current_app import fedmsg.consumers import requests @@ -102,7 +103,7 @@ class WaiverDBHandler(fedmsg.consumers.FedmsgConsumer): 'subject_identifier': subject_identifier, } response = requests_session.post( - self.fedmsg_config['greenwave_api_url'] + '/decision', + current_app.config['GREENWAVE_API_URL'] + '/decision', headers={'Content-Type': 'application/json'}, data=json.dumps(data)) @@ -117,7 +118,7 @@ class WaiverDBHandler(fedmsg.consumers.FedmsgConsumer): 'ignore_waiver': [waiver_id], }) response = requests_session.post( - self.fedmsg_config['greenwave_api_url'] + '/decision', + current_app.config['GREENWAVE_API_URL'] + '/decision', headers={'Content-Type': 'application/json'}, data=json.dumps(data))