From 3c25960e2609203a70a0aea6a204e2d00bf74acf Mon Sep 17 00:00:00 2001 From: Yuming Zhu Date: Dec 07 2023 20:20:43 +0000 Subject: 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 --- diff --git a/kojihub/kojihub.py b/kojihub/kojihub.py index 9c67903..5cf0c94 100644 --- a/kojihub/kojihub.py +++ b/kojihub/kojihub.py @@ -9889,7 +9889,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: @@ -9903,10 +9902,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)