diff --git a/nodepool/builder.py b/nodepool/builder.py index 06c82d469..76013e77d 100644 --- a/nodepool/builder.py +++ b/nodepool/builder.py @@ -221,27 +221,26 @@ class CleanupWorker(BaseWorker): if e.errno != 2: # No such file or directory raise e - def _deleteLocalBuild(self, image, build_id, builder): + def _deleteLocalBuild(self, image, build): ''' Remove expired image build from local disk. :param str image: Name of the image whose build we are deleting. - :param str build_id: ID of the build we want to delete. - :param str builder: hostname of the build. + :param ImageBuild build: The build we want to delete. :returns: True if files were deleted, False if none were found. ''' - base = "-".join([image, build_id]) + base = "-".join([image, build.id]) files = DibImageFile.from_image_id(self._config.imagesdir, base) if not files: # NOTE(pabelanger): It is possible we don't have any files because # diskimage-builder failed. So, check to see if we have the correct # builder so we can removed the data from zookeeper. - if builder == self._hostname: + if build.builder == self._hostname: return True return False - self.log.info("Doing cleanup for %s:%s" % (image, build_id)) + self.log.info("Doing cleanup for %s:%s" % (image, build.id)) manifest_dir = None @@ -468,7 +467,7 @@ class CleanupWorker(BaseWorker): self._zk.storeBuild(image, build, build.id) # Release the lock here so we can delete the build znode - if self._deleteLocalBuild(image, build.id, build.builder): + if self._deleteLocalBuild(image, build): if not self._zk.deleteBuild(image, build.id): self.log.error("Unable to delete build %s because" " uploads still remain.", build)