fix errors in channel policy

Fixes: https://pagure.io/koji/issue/4065
This commit is contained in:
Mike McLean 2024-03-28 12:24:38 -04:00 committed by Tomas Kopecek
parent d0de585229
commit d0e90d3687
2 changed files with 7 additions and 2 deletions

View file

@ -135,8 +135,12 @@ class MatchTest(BaseSimpleTest):
field = self.field
if field not in data:
return False
value = data[field]
if value is None:
# None does not match any pattern
return False
for pattern in args:
if fnmatch.fnmatch(data[field], pattern):
if fnmatch.fnmatch(value, pattern):
return True
return False

View file

@ -10150,7 +10150,8 @@ def policy_data_from_task_args(method, arglist):
target = tinfo['name']
policy_data['target'] = target
t_opts = params.get('opts', {})
# we may have param['opts'] that is explicitly None
t_opts = params.get('opts') or {}
policy_data['scratch'] = t_opts.get('scratch', False)
return policy_data