From a5f4e40537f1d8722ec3d3a6085d37a33d65d1cf Mon Sep 17 00:00:00 2001 From: Franz Chih-Ping Hsieh Date: Aug 14 2018 21:20:52 +0000 Subject: PR#1000: Fix target handling in make_task Merges #1000 https://pagure.io/koji/pull-request/1000 Fixes: #998 https://pagure.io/koji/issue/998 cancel build doesn't work for images --- diff --git a/hub/kojihub.py b/hub/kojihub.py index 49dc914..2387cfe 100644 --- a/hub/kojihub.py +++ b/hub/kojihub.py @@ -543,16 +543,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)