From a9355d8df5d292cc79ab7b85e7d3eaab8cba0e03 Mon Sep 17 00:00:00 2001 From: Lukas Holecek Date: Aug 21 2020 09:01:34 +0000 Subject: Fix using correct dist-git URL template Fixes precedence for using dist-git URL template configuration, specifically: `REMOTE_RULE_POLICIES['*']` shall be used before `DIST_GIT_URL_TEMPLATE`. JIRA: RHELWF-1604 Signed-off-by: Lukas Holecek --- diff --git a/greenwave/policies.py b/greenwave/policies.py index 4e335cc..9684746 100644 --- a/greenwave/policies.py +++ b/greenwave/policies.py @@ -445,11 +445,12 @@ class RemoteRule(Rule): return [] rr_policies_conf = current_app.config.get('REMOTE_RULE_POLICIES', {}) - cur_subject_url = rr_policies_conf.get( - policy.subject_type, current_app.config.get( - 'DIST_GIT_URL_TEMPLATE', rr_policies_conf.get('*') - ) + cur_subject_url = ( + rr_policies_conf.get(policy.subject_type) or + rr_policies_conf.get('*') or + current_app.config.get('DIST_GIT_URL_TEMPLATE') ) + if not cur_subject_url: raise RuntimeError(f'Cannot use a remote rule for {subject} subject ' f'as it has not been configured')