Use anonymous Koji session properly

MBS calls some read-only Koji APIs which does not require to log into a
session. This patch makes it optional to choose whether to login a
session and use anonymous session properly to call those read-only APIs.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
This commit is contained in:
Chenxiong Qi
2018-12-06 15:43:09 +08:00
parent 61d8b22fc3
commit 55add5cfc0
5 changed files with 41 additions and 38 deletions

View File

@@ -588,7 +588,8 @@ class SCMBuilder(BaseBuilder):
if not self.koji_session:
# If Koji is not configured on the system, then just return 0.0 for components
try:
self.koji_session = KojiModuleBuilder.get_session(self.config, self.owner)
self.koji_session = KojiModuleBuilder.get_session(
self.config, self.owner, login=False)
# If the component has not been built before, then None is returned. Instead,
# let's return 0.0 so the type is consistent
return self.koji_session.getAverageBuildDuration(component.package) or 0.0