Consider hostname in determining local builds

If DIB fails to produce local files, or if we remove a failing diskimage
from the config before the ZooKeeper node has been removed, we never
remove the znode. Work around this by considering any recorded builds
that have a 'builder' that matches the host doing the cleanup as owned
by that host.

Change-Id: Id3b1e2ae0d0f71209cd66091a7d69143b0b4b20c
This commit is contained in:
David Shrewsbury 2017-06-02 12:35:47 -04:00
parent 1cb82d6313
commit 9a15144c9b
1 changed files with 3 additions and 1 deletions

View File

@ -353,7 +353,9 @@ class CleanupWorker(BaseWorker):
for build in builds:
base = "-".join([image, build.id])
files = DibImageFile.from_image_id(self._config.imagesdir, base)
if files:
# If we have local dib files OR if our hostname matches the
# recorded owner hostname, consider this our build.
if files or (self._hostname == build.builder):
ret.append(build)
return ret