Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions obal/data/modules/check_koji_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def main():
"""
module = AnsibleModule(
argument_spec=dict(
tag=dict(type='str', required=True),
tag=dict(type='str', required=False),
nevr=dict(type='str', required=True),
package=dict(type='str', required=True),
koji_executable=dict(type='str', required=False)
Expand All @@ -23,13 +23,20 @@ def main():
package = module.params['package']
koji_executable = module.params['koji_executable']

command = ['latest-build', '--quiet', tag, package]

try:
build = koji(command, koji_executable)
build = build.split(' ')[0]
if tag:
command = ['latest-build', '--quiet', tag, package]
build = koji(command, koji_executable)
build = build.split(' ')[0]

module.exit_json(changed=False, tagged_version=build, exists=(nevr == build))
else:
command = ['buildinfo', nevr]
output = koji(command, koji_executable)
Comment thread
evgeni marked this conversation as resolved.
exists = 'No such build' not in output

module.exit_json(changed=False, exists=exists)

module.exit_json(changed=False, tagged_version=build, exists=(nevr == build))
except KojiCommandError as error:
module.fail_json(changed=False, msg=error.message, command=error.command)

Expand Down