Don't trigger init handler when importing a local build and mark the build as done after import

This commit is contained in:
mprahl
2017-11-09 15:33:40 -05:00
parent b0eada3e33
commit 243e8873d5
2 changed files with 11 additions and 8 deletions

View File

@@ -254,7 +254,7 @@ class ModuleBuild(MBSBase):
@classmethod
def create(cls, session, conf, name, stream, version, modulemd, scmurl, username,
copr_owner=None, copr_project=None, rebuild_strategy=None):
copr_owner=None, copr_project=None, rebuild_strategy=None, publish_msg=True):
now = datetime.utcnow()
module = cls(
name=name,
@@ -276,12 +276,13 @@ class ModuleBuild(MBSBase):
module.module_builds_trace.append(mbt)
session.add(module)
session.commit()
module_build_service.messaging.publish(
service='mbs',
topic='module.state.change',
msg=module.extended_json(), # Note the state is "init" here...
conf=conf,
)
if publish_msg:
module_build_service.messaging.publish(
service='mbs',
topic='module.state.change',
msg=module.extended_json(), # Note the state is "init" here...
conf=conf,
)
return module
def transition(self, conf, state, state_reason=None):

View File

@@ -703,8 +703,10 @@ def load_local_builds(local_build_nsvs, session=None):
version=str(mmd.version),
modulemd=mmd.dumps(),
scmurl="",
username="mbs")
username="mbs",
publish_msg=False)
module.koji_tag = path
module.state = models.BUILD_STATES['done']
session.commit()
if (found_build[0] != module.name or found_build[1] != module.stream or