getTag returns query_event
This commit is contained in:
parent
3cfedc9fd3
commit
72108bc029
1 changed files with 21 additions and 16 deletions
|
|
@ -3380,6 +3380,8 @@ def get_tag(tagInfo, strict=False, event=None, blocked=False):
|
|||
- maven_support : maven support flag (boolean)
|
||||
- maven_include_all : maven include all flag (boolean)
|
||||
- extra : extra tag parameters (dictionary)
|
||||
- query_event : return "event" parameter for current call
|
||||
if something was passed in
|
||||
|
||||
If there is no tag matching the given tagInfo, and strict is False,
|
||||
return None. If strict is True, raise a GenericError.
|
||||
|
|
@ -3442,6 +3444,8 @@ def get_tag(tagInfo, strict=False, event=None, blocked=False):
|
|||
raise koji.GenericError("No such tagInfo: %r" % tagInfo)
|
||||
return None
|
||||
result['extra'] = get_tag_extra(result, event, blocked=blocked)
|
||||
if event is not None:
|
||||
result['query_event'] = event
|
||||
return result
|
||||
|
||||
|
||||
|
|
@ -9587,40 +9591,35 @@ def policy_get_cgs(data):
|
|||
|
||||
def policy_get_build_tags(data, taginfo=False):
|
||||
"""If taginfo is set, return list of taginfos, else list of names only"""
|
||||
tags = {}
|
||||
if 'build_tag' in data:
|
||||
buildtag = get_tag(data['build_tag'], strict=True, event="auto")
|
||||
# only cases we don't return list
|
||||
if taginfo:
|
||||
return buildtag
|
||||
else:
|
||||
return buildtag['name']
|
||||
elif 'build_tags' in data:
|
||||
build_tags = [get_tag(t, strict=True, event="auto") for t in data['build_tags']]
|
||||
if taginfo:
|
||||
return build_tags
|
||||
else:
|
||||
return [t['name'] for t in build_tags]
|
||||
for tag in build_tags:
|
||||
tags[tag['name']] = tag
|
||||
|
||||
# see if we have a target
|
||||
target = data.get('target')
|
||||
if target:
|
||||
target = get_build_target(target, strict=False)
|
||||
if target:
|
||||
if taginfo:
|
||||
return [get_tag(target['build_tag'], strict=True, event="auto")]
|
||||
else:
|
||||
return [target['build_tag_name']]
|
||||
tags[target['build_tag_name']] = get_tag(target['build_tag'], strict=True,
|
||||
event="auto")
|
||||
|
||||
# otherwise look at buildroots
|
||||
tags = {}
|
||||
for br_id in policy_get_brs(data):
|
||||
if br_id is None:
|
||||
tags[None] = None
|
||||
else:
|
||||
tinfo = get_buildroot(br_id, strict=True)
|
||||
if taginfo:
|
||||
tags[tinfo['tag_name']] = get_tag(tinfo['tag_name'], strict=True, event="auto")
|
||||
else:
|
||||
tags[tinfo['tag_name']] = tinfo['tag_name']
|
||||
tags[tinfo['tag_name']] = get_tag(tinfo['tag_name'], strict=True,
|
||||
event=tinfo['repo_create_event_id'])
|
||||
|
||||
if taginfo:
|
||||
tags = tags.values()
|
||||
|
|
@ -9839,9 +9838,15 @@ class BuildTagInheritsFromTest(koji.policy.BaseSimpleTest):
|
|||
# content generator buildroots might not have tag info
|
||||
continue
|
||||
|
||||
# for possibly deleted tags in inheritance chain
|
||||
# we need to look into event from last known configuration
|
||||
for tag in readFullInheritance(tinfo['id'], event=tinfo.get('revoke_event')):
|
||||
if tinfo.get('query_event') == 'auto':
|
||||
# in case of "auto" for deleted tag revoke_event is last known event
|
||||
# in case of "auto" for non-deleted tag, None is a correct active value
|
||||
event = tinfo.get('revoke_event')
|
||||
else:
|
||||
# if there is "query_event" other then "auto" we want to propagate it
|
||||
# in rest of cases (non-existent "query_event" field), pass None
|
||||
event = tinfo.get('query_event')
|
||||
for tag in readFullInheritance(tinfo['id'], event=event):
|
||||
if multi_fnmatch(tag['name'], args):
|
||||
return True
|
||||
# otherwise...
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue