PR#2916: [policy] use "name" in result of lookup_name for CGs
Merges #2916 https://pagure.io/koji/pull-request/2916 Fixes: #2915 https://pagure.io/koji/issue/2915 "cg_match_any" policy check fails when doing cg_import
This commit is contained in:
commit
00ffe20b40
2 changed files with 3 additions and 2 deletions
|
|
@ -9362,7 +9362,7 @@ def policy_get_cgs(data):
|
|||
# pull cg info out
|
||||
# note that br_id will be None if a component had no buildroot
|
||||
if 'cg_list' in data:
|
||||
cgs = [lookup_name('content_generator', cg, strict=True)
|
||||
cgs = [lookup_name('content_generator', cg, strict=True)['name']
|
||||
for cg in data['cg_list']]
|
||||
return set(cgs)
|
||||
# otherwise try buildroot data
|
||||
|
|
|
|||
|
|
@ -136,11 +136,12 @@ class TestPolicyGetCGs(unittest.TestCase):
|
|||
'build': 'whatever',
|
||||
'buildroots': [],
|
||||
}
|
||||
|
||||
def my_lookup_name(table, info, strict=False, create=False):
|
||||
self.assertEqual(strict, True)
|
||||
self.assertEqual(create, False)
|
||||
self.assertEqual(table, 'content_generator')
|
||||
return "cg %i" % info
|
||||
return {'id': info, 'name': "cg %i" % info}
|
||||
self.lookup_name.side_effect = my_lookup_name
|
||||
|
||||
result = kojihub.policy_get_cgs(data)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue