From 1d02394c4b7432870d1cd326e07f64cd115959ad Mon Sep 17 00:00:00 2001 From: Yuming Zhu Date: Sat, 11 Nov 2023 00:12:43 +0800 Subject: [PATCH] policy_data_from_task_args: set target in policy_data to None if it doesn't exist for build task, the `build target` could be `destination tag` when `opts.repo_id` is specified fixes #3941 --- kojihub/kojihub.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/kojihub/kojihub.py b/kojihub/kojihub.py index c31d5e63..2966c53b 100644 --- a/kojihub/kojihub.py +++ b/kojihub/kojihub.py @@ -10098,7 +10098,6 @@ def policy_data_from_task_args(method, arglist): policy_data['source'] = params.get(k) break # parameters that indicate build target - target = None hastarget = False for k in ('target', 'build_target', 'target_info'): if k in params: @@ -10112,10 +10111,15 @@ def policy_data_from_task_args(method, arglist): target = None else: target = target.get('name') - if target is None: - policy_data['target'] = None - else: - policy_data['target'] = get_build_target(target, strict=True)['name'] + if target is not None: + tinfo = lookup_build_target(target, strict=False) + if tinfo is None: + logger.warning("No such build target: %s", target) + target = None + else: + target = tinfo['name'] + policy_data['target'] = target + t_opts = params.get('opts', {}) policy_data['scratch'] = t_opts.get('scratch', False)