rename imagesdir/elementdir with underscore

This makes absolutely no functional difference, but in a follow-on I
wish to add images_dir_required_free and the mix of underscores with
these values is inconsistent.

Change-Id: I2566afbd5c78c39bfa8f2fce32e2374a589b45aa
This commit is contained in:
Ian Wienand 2020-11-26 15:15:37 +11:00
parent 36666fbb2f
commit 45704178e9
4 changed files with 18 additions and 18 deletions

@ -286,7 +286,7 @@ class CleanupWorker(BaseWorker):
def _deleteLocalBuild(self, image, build):
CleanupWorker.deleteLocalBuild(
self._config.imagesdir, image, build, self.log)
self._config.images_dir, image, build, self.log)
def _cleanupProvider(self, provider, image, build_id):
all_uploads = self._zk.getUploads(image, build_id, provider.name)
@ -723,7 +723,7 @@ class BuildWorker(BaseWorker):
bnum, diskimage.name)
data.id = bnum
CleanupWorker.deleteLocalBuild(
self._config.imagesdir, diskimage.name, data, self.log)
self._config.images_dir, diskimage.name, data, self.log)
data.state = zk.FAILED
return data
@ -800,7 +800,7 @@ class BuildWorker(BaseWorker):
'''
base = "-".join([diskimage.name, build_id])
image_file = DibImageFile(base)
filename = image_file.to_path(self._config.imagesdir, False)
filename = image_file.to_path(self._config.images_dir, False)
env = os.environ.copy()
env['DIB_RELEASE'] = diskimage.release
@ -810,8 +810,8 @@ class BuildWorker(BaseWorker):
# Note we use a reference to the nodepool config here so
# that whenever the config is updated we get up to date
# values in this thread.
if self._config.elementsdir:
env['ELEMENTS_PATH'] = self._config.elementsdir
if self._config.elements_dir:
env['ELEMENTS_PATH'] = self._config.elements_dir
# send additional env vars if needed
for k, v in diskimage.env_vars.items():
@ -1076,7 +1076,7 @@ class UploadWorker(BaseWorker):
self.log.debug("Found image file of type %s for image id: %s" %
(image.extension, image.image_id))
filename = image.to_path(self._config.imagesdir, with_extension=True)
filename = image.to_path(self._config.images_dir, with_extension=True)
ext_image_name = provider.image_name_format.format(
image_name=image_name, timestamp=str(timestamp)
@ -1225,7 +1225,7 @@ class UploadWorker(BaseWorker):
# Search for locally built images. The image name and build
# sequence ID is used to name the image.
local_images = DibImageFile.from_image_id(
self._config.imagesdir, "-".join([image.name, build.id]))
self._config.images_dir, "-".join([image.name, build.id]))
if not local_images:
return False
@ -1369,7 +1369,7 @@ class NodePoolBuilder(object):
nodepool_config.loadSecureConfig(config, self._secure_path)
if not config.zookeeper_servers.values():
raise RuntimeError('No ZooKeeper servers specified in config.')
if not config.imagesdir:
if not config.images_dir:
raise RuntimeError('No images-dir specified in config.')
return config
@ -1392,7 +1392,7 @@ class NodePoolBuilder(object):
self._config = self._getAndValidateConfig()
self._running = True
builder_id_file = os.path.join(self._config.imagesdir,
builder_id_file = os.path.join(self._config.images_dir,
"builder_id.txt")
builder_id = self._getBuilderID(builder_id_file)

@ -41,8 +41,8 @@ class Config(ConfigValue):
self.zookeeper_tls_cert = None
self.zookeeper_tls_key = None
self.zookeeper_tls_ca = None
self.elementsdir = None
self.imagesdir = None
self.elements_dir = None
self.images_dir = None
self.build_log_dir = None
self.build_log_retention = None
self.max_hold_age = None
@ -55,8 +55,8 @@ class Config(ConfigValue):
self.providers == other.providers and
self.provider_managers == other.provider_managers and
self.zookeeper_servers == other.zookeeper_servers and
self.elementsdir == other.elementsdir and
self.imagesdir == other.imagesdir and
self.elements_dir == other.elements_dir and
self.images_dir == other.images_dir and
self.build_log_dir == other.build_log_dir and
self.build_log_retention == other.build_log_retention and
self.max_hold_age == other.max_hold_age and
@ -64,10 +64,10 @@ class Config(ConfigValue):
return False
def setElementsDir(self, value):
self.elementsdir = value
self.elements_dir = value
def setImagesDir(self, value):
self.imagesdir = value
self.images_dir = value
def setBuildLog(self, directory, retention):
if retention is None:

@ -543,7 +543,7 @@ class TestNodePoolBuilder(tests.DBTestCase):
# There shouldn't be any DIB files even though cleanup thread is
# disabled because the builder should clean up after itself.
images_dir = bldr._config.imagesdir
images_dir = bldr._config.images_dir
# Wait for builder to remove the leaked files
image_files = builder.DibImageFile.from_image_id(
@ -598,7 +598,7 @@ class TestNodePoolBuilder(tests.DBTestCase):
bldr = self.useBuilder(configfile)
self.waitForImage('fake-provider', 'fake-image')
images_dir = bldr._config.imagesdir
images_dir = bldr._config.images_dir
post_file = os.path.join(
images_dir, 'fake-image-0000000001.qcow2.post')
self.assertTrue(os.path.exists(post_file), 'Post hook file exists')

@ -54,7 +54,7 @@ class TestConfigComparisons(tests.BaseTestCase):
a = Config()
b = Config()
self.assertEqual(a, b)
a.imagesdir = "foo"
a.images_dir = "foo"
self.assertNotEqual(a, b)
def test_Label(self):