Fix W1201 - logging-not-lazy

openstack-tox-linters is complaining about not using
lazy formatting in logging functions.

Change-Id: Ia1c7b3ce2c809ec1f34c512dc8087d6bca215e46
Closes-Bug: #1911681
This commit is contained in:
Harald Jensås 2021-01-14 13:16:07 +01:00
parent 557e56bd1e
commit acf9eb95d7
4 changed files with 11 additions and 11 deletions

View File

@ -55,7 +55,7 @@ class BaseImageManager(object):
data = yaml.safe_load(cf.read()).get(section)
if not data:
return None
self.logger.debug('%s JSON: %s' % (section, str(data)))
self.logger.debug('%s JSON: %s', (section, str(data)))
for item in data:
image_name = item.get('imagename')
if image_name is None:
@ -65,7 +65,7 @@ class BaseImageManager(object):
if self.images is not None and \
image_name not in self.images:
self.logger.debug('Image %s ignored' % image_name)
self.logger.debug('Image %s ignored', image_name)
continue
existing_image = config_data.get(image_name)
@ -84,11 +84,11 @@ class BaseImageManager(object):
config_data[image_name] = existing_image
else:
self.logger.error('No config file exists at: %s' % config_file)
self.logger.error('No config file exists at: %s', config_file)
raise IOError('No config file exists at: %s' % config_file)
return [x for x in config_data.values()]
def json_output(self):
self.logger.info('Using config files: %s' % self.config_files)
self.logger.info('Using config files: %s', self.config_files)
disk_images = self.load_config_files(self.DISK_IMAGES)
print(json.dumps(disk_images))

View File

@ -44,7 +44,7 @@ class ImageBuildManager(BaseImageManager):
def build(self):
"""Start the build process"""
self.logger.info('Using config files: %s' % self.config_files)
self.logger.info('Using config files: %s', self.config_files)
disk_images = self.load_config_files(self.DISK_IMAGES)
@ -59,13 +59,13 @@ class ImageBuildManager(BaseImageManager):
node_dist = image.get('distro')
if node_dist is None:
raise ImageSpecificationException('distro is required')
self.logger.info('imagename: %s' % image_name)
self.logger.info('imagename: %s', image_name)
image_extension = image.get('imageext', image_type)
image_path = os.path.join(self.output_directory, image_name)
if self.skip:
self.logger.info('looking for image at path: %s' % image_path)
self.logger.info('looking for image at path: %s', image_path)
if os.path.exists('%s.%s' % (image_path, image_extension)):
self.logger.info('Image file exists for image name: %s' %
self.logger.info('Image file exists for image name: %s',
image_name)
self.logger.info('Skipping image build')
continue

View File

@ -117,8 +117,8 @@ class DibImageBuilder(ImageBuilder):
log_file = '%s.log' % image_path
self.logger.info('Running %s' % cmd)
self.logger.info('Logging output to %s' % log_file)
self.logger.info('Running %s', cmd)
self.logger.info('Logging output to %s', log_file)
process = subprocess.Popen(cmd,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)

View File

@ -549,7 +549,7 @@ class KollaImageBuilder(base.BaseImageManager):
raise subprocess.CalledProcessError(process.returncode, cmd, err)
if template_only:
self.logger.info('Running %s' % ' '.join(cmd_deps))
self.logger.info('Running %s', ' '.join(cmd_deps))
env = os.environ.copy()
process = subprocess.Popen(cmd_deps, env=env,
stdout=subprocess.PIPE,