From 6fd16587bcdfa06112f78e7e5c198f3df9f9fbcb Mon Sep 17 00:00:00 2001 From: Jan Kaluza Date: Mon, 31 Oct 2016 13:14:31 +0100 Subject: [PATCH] Ignore repository builds without the '-build' suffix. --- module_build_service/scheduler/handlers/repos.py | 6 +++++- tests/test_scheduler/test_repo_done.py | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/module_build_service/scheduler/handlers/repos.py b/module_build_service/scheduler/handlers/repos.py index f1683cd8..dcdfafb2 100644 --- a/module_build_service/scheduler/handlers/repos.py +++ b/module_build_service/scheduler/handlers/repos.py @@ -36,7 +36,11 @@ def done(config, session, msg): """ Called whenever koji rebuilds a repo, any repo. """ # First, find our ModuleBuild associated with this repo, if any. - tag = msg.repo_tag.strip('-build') + tag = msg.repo_tag + if not tag.endswith('-build'): + log.info("Tag %r does not end with '-build' suffix, ignoring" % tag) + return + tag = tag.strip('-build') module_build = models.ModuleBuild.from_repo_done_event(session, msg) if not module_build: log.info("No module build found associated with koji tag %r" % tag) diff --git a/tests/test_scheduler/test_repo_done.py b/tests/test_scheduler/test_repo_done.py index 2aa9c9d3..545ed634 100644 --- a/tests/test_scheduler/test_repo_done.py +++ b/tests/test_scheduler/test_repo_done.py @@ -46,7 +46,7 @@ class TestRepoDone(unittest.TestCase): """ from_repo_done_event.return_value = None msg = module_build_service.messaging.KojiRepoChange( - 'no matches for this...', '2016-some-guid') + 'no matches for this...', '2016-some-guid-build') self.fn(config=self.config, session=self.session, msg=msg) @mock.patch('module_build_service.builder.KojiModuleBuilder.buildroot_ready') @@ -76,7 +76,7 @@ class TestRepoDone(unittest.TestCase): ready.return_value = True msg = module_build_service.messaging.KojiRepoChange( - 'no matches for this...', '2016-some-guid') + 'no matches for this...', '2016-some-guid-build') self.fn(config=self.config, session=self.session, msg=msg) build_fn.assert_called_once_with(artifact_name='foo', source='full_scm_url') @@ -109,7 +109,7 @@ class TestRepoDone(unittest.TestCase): ready.return_value = True msg = module_build_service.messaging.KojiRepoChange( - 'no matches for this...', '2016-some-guid') + 'no matches for this...', '2016-some-guid-build') self.fn(config=self.config, session=self.session, msg=msg) build_fn.assert_called_once_with(artifact_name='foo', source='full_scm_url') module_build.transition.assert_called_once_with(self.config,