Stop comparing hostnames to determine ownership

We shouldn't need to compare hostnames at this point since that
was an artifact of maintaining compatibility with existing ZK
data before we added unique build host IDs. That data should long
since be gone everywhere.

Change-Id: Ia94f20b15ab9cf2ae4969891eedccec8d5291d36
This commit is contained in:
David Shrewsbury
2020-03-13 15:57:11 -04:00
parent 334dfdc77c
commit 719730e534

View File

@@ -388,11 +388,7 @@ class CleanupWorker(BaseWorker):
'''Return the subset of builds that are local'''
ret = []
for build in builds:
# To maintain backward compatibility with builders that didn't
# use unique builder IDs before, but do now, always compare to
# hostname as well since some ZK data may still reference that.
is_local = build.builder_id == self._builder_id or \
build.builder == self._hostname
is_local = build.builder_id == self._builder_id
if is_local:
ret.append(build)
return ret
@@ -510,12 +506,8 @@ class CleanupWorker(BaseWorker):
# provider uploads are in a deleting state. This prevents us from
# keeping local files around while we wait on clouds to remove
# the image on their side (which can be very slow).
# To maintain backward compatibility with builders that didn't
# use unique builder IDs before, but do now, always compare to
# hostname as well since some ZK data may still reference that.
all_deleting = all(map(lambda x: x.state == zk.DELETING, uploads))
is_local = build.builder_id == self._builder_id or \
build.builder == self._hostname
is_local = build.builder_id == self._builder_id
if (not uploads or all_deleting) and is_local:
self._deleteLocalBuild(image, build)