[FIX] runbot_merge: FF error logging message

In case of error while fast-forwarding a staging to its source, we'd
log the target to which we couldn't FF. Sadly this relied on a
`repo_name` variable which (likely since the introduction of the
"safety dance" fast forwarding) can not actually be set in case of
failure.

So stash the relevant bit (the repo name) inside the FF error exception
and use that to compose our logging message instead of a variable which
can only be None.
This commit is contained in:
xmo-odoo 2019-08-26 13:41:11 +02:00 committed by GitHub
parent 222f591deb
commit 8b74e79da9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -116,7 +116,7 @@ class GH(object):
_logger.debug('fast_forward(%s, %s, %s) -> OK', self._repo, branch, sha)
except requests.HTTPError:
_logger.debug('fast_forward(%s, %s, %s) -> ERROR', self._repo, branch, sha, exc_info=True)
raise exceptions.FastForwardError()
raise exceptions.FastForwardError(self._repo)
def set_ref(self, branch, sha):
# force-update ref

View File

@ -1402,7 +1402,6 @@ class Stagings(models.Model):
project = self.target.project_id
if self.state == 'success':
gh = {repo.name: repo.github() for repo in project.repo_ids}
repo_name = None
staging_heads = json.loads(self.heads)
self.env.cr.execute('''
SELECT 1 FROM runbot_merge_pull_requests
@ -1410,11 +1409,11 @@ class Stagings(models.Model):
FOR UPDATE
''', [tuple(self.mapped('batch_ids.prs.id'))])
try:
repo_name = self._safety_dance(gh, staging_heads)
self._safety_dance(gh, staging_heads)
except exceptions.FastForwardError as e:
logger.warning(
"Could not fast-forward successful staging on %s:%s",
repo_name, self.target.name,
e.args[0], self.target.name,
exc_info=True
)
self.write({