From 3d9445c33a4db4c5b6be84417f4e315749dbf787 Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Jul 30 2018 08:18:28 +0000 Subject: Fix target handling in make_task Fixes: https://pagure.io/koji/issue/998 --- diff --git a/hub/kojihub.py b/hub/kojihub.py index 22dd484..20ec112 100644 --- a/hub/kojihub.py +++ b/hub/kojihub.py @@ -546,16 +546,16 @@ def make_task(method, arglist, **opts): hastarget = True break if hastarget: - if target is None: - policy_data['target'] = None - elif isinstance(target, dict): + if isinstance(target, dict): if 'name' not in target: - hastarget = False logger.warning("Bad build target parameter: %r", target) + target = None else: target = target.get('name') - if hastarget: - policy_data['target'] = get_build_target(target, strict=True)['name'] + if target is None: + policy_data['target'] = None + else: + policy_data['target'] = get_build_target(target, strict=True)['name'] t_opts = params.get('opts', {}) policy_data['scratch'] = t_opts.get('scratch', False)