Merge #501 Stop using .strip('-build')

This commit is contained in:
Jan Kaluža
2017-04-07 13:37:56 +00:00
2 changed files with 6 additions and 3 deletions

View File

@@ -223,7 +223,10 @@ class ModuleBuild(MBSBase):
There should be at most one.
"""
tag = event.repo_tag.strip('-build')
if event.repo_tag.endswith('-build'):
tag = event.repo_tag[:-6]
else:
tag = event.repo_tag
query = session.query(cls)\
.filter(cls.koji_tag == tag)\
.filter(cls.state == BUILD_STATES["build"])
@@ -236,7 +239,7 @@ class ModuleBuild(MBSBase):
@classmethod
def from_tag_change_event(cls, session, event):
tag = event.tag.strip('-build')
tag = event.tag[:-6] if event.tag.endswith('-build') else event.tag
query = session.query(cls)\
.filter(cls.koji_tag == tag)\
.filter(cls.state == BUILD_STATES["build"])

View File

@@ -41,7 +41,7 @@ def done(config, session, msg):
if config.system == "koji" and not tag.endswith('-build'):
log.debug("Tag %r does not end with '-build' suffix, ignoring" % tag)
return
tag = tag.strip('-build')
tag = tag[:-6] if tag.endswith('-build') else tag
module_build = models.ModuleBuild.from_repo_done_event(session, msg)
if not module_build:
log.debug("No module build found associated with koji tag %r" % tag)