Delete repo if unable to reset
If a merger or executor is unable to reset a repo, we currently simply log the message "Unable to reset repo". Instead, let's assume that it is permanently broken and rmtree it so that future attempts will automatically recover. Change-Id: I17b051d70a9c5800019bf9ef7e0800558614cadd
This commit is contained in:
parent
d6ace2cec6
commit
1cd1d3f4de
|
@ -401,13 +401,18 @@ class Repo(object):
|
||||||
log.debug("Resetting repository %s", self.local_path)
|
log.debug("Resetting repository %s", self.local_path)
|
||||||
self.createRepoObject(zuul_event_id, build=build)
|
self.createRepoObject(zuul_event_id, build=build)
|
||||||
|
|
||||||
|
try:
|
||||||
if process_worker is None:
|
if process_worker is None:
|
||||||
self._reset(self.local_path, self.env, log)
|
self._reset(self.local_path, self.env, log)
|
||||||
else:
|
else:
|
||||||
job = process_worker.submit(Repo._reset, self.local_path, self.env)
|
job = process_worker.submit(
|
||||||
|
Repo._reset, self.local_path, self.env)
|
||||||
messages = job.result()
|
messages = job.result()
|
||||||
for message in messages:
|
for message in messages:
|
||||||
log.debug(message)
|
log.debug(message)
|
||||||
|
except Exception:
|
||||||
|
shutil.rmtree(self.local_path)
|
||||||
|
raise
|
||||||
|
|
||||||
def getBranchHead(self, branch, zuul_event_id=None):
|
def getBranchHead(self, branch, zuul_event_id=None):
|
||||||
repo = self.createRepoObject(zuul_event_id)
|
repo = self.createRepoObject(zuul_event_id)
|
||||||
|
|
Loading…
Reference in New Issue