Remove deprecated warn() call

Instead warning() should be called.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2020-01-29 13:26:17 +01:00
parent 116c617b86
commit 4c6396f491
4 changed files with 28 additions and 17 deletions

View File

@ -628,9 +628,8 @@ class Pungi(PungiBase):
deps = self.ayum.whatProvides(r, f, v).returnPackages()
deps = self.excludePackages(deps)
if not deps:
self.logger.warn(
"Unresolvable dependency %s in %s.%s"
% (Req(req), po.name, po.arch)
self.logger.warning(
"Unresolvable dependency %s in %s.%s", Req(req), po.name, po.arch
)
continue
@ -670,7 +669,13 @@ class Pungi(PungiBase):
added.add(dep)
except (yum.Errors.InstallError, yum.Errors.YumBaseError) as ex:
self.logger.warn("Unresolvable dependency %s in %s.%s (repo: %s)" % (r, po.name, po.arch, po.repoid))
self.logger.warning(
"Unresolvable dependency %s in %s.%s (repo: %s)",
r,
po.name,
po.arch,
po.repoid,
)
continue
self.resolved_deps[req] = None
@ -920,7 +925,9 @@ class Pungi(PungiBase):
matches = [ po for po in matches if po.arch in self.valid_multilib_arches ]
if not matches:
self.logger.warn('Could not find a match for %s in any configured repo' % pattern)
self.logger.warning(
"Could not find a match for %s in any configured repo", pattern
)
continue
packages_by_name = {}

View File

@ -368,7 +368,9 @@ class Gather(GatherBase):
self.finished_get_package_deps_reqs[str(req)].update(deps)
result.update((dep, req) for dep in deps)
else:
self.logger.warn("Unresolvable dependency %s in %s.%s" % (req, pkg.name, pkg.arch))
self.logger.warning(
"Unresolvable dependency %s in %s.%s", req, pkg.name, pkg.arch
)
return result
@ -508,7 +510,7 @@ class Gather(GatherBase):
if pkgs:
added.update(pkgs)
else:
self.logger.warn("Prepopulate: Doesn't match: %s" % name_arch)
self.logger.warning("Prepopulate: Doesn't match: %s", name_arch)
for pkg in added:
self._set_flag(pkg, PkgFlag.prepopulate)

View File

@ -88,8 +88,9 @@ class CreateisoPhase(PhaseLoggerMixin, PhaseBase):
continue
if not self._find_rpms(os_tree):
self.logger.warn("No RPMs found for %s.%s, skipping ISO"
% (variant.uid, arch))
self.logger.warning(
"No RPMs found for %s.%s, skipping ISO" % (variant.uid, arch)
)
continue
bootable = self._is_bootable(variant, arch)
@ -112,7 +113,9 @@ class CreateisoPhase(PhaseLoggerMixin, PhaseBase):
iso_path = self.compose.paths.compose.iso_path(
arch, variant, filename, symlink_to=symlink_isos_to)
if os.path.isfile(iso_path):
self.logger.warn("Skipping mkisofs, image already exists: %s" % iso_path)
self.logger.warning(
"Skipping mkisofs, image already exists: %s", iso_path
)
continue
deliverables.append(iso_path)
@ -369,11 +372,10 @@ def split_iso(compose, arch, variant, no_split=False, logger=None):
logger.debug('Splitting media for %s.%s:' % (variant.uid, arch))
result = ms.split()
if no_split and result[0]['size'] > split_size:
logger.warn('ISO for %s.%s does not fit on single media! '
'It is %s bytes too big. (Total size: %s B)'
% (variant.uid, arch,
result[0]['size'] - split_size,
result[0]['size']))
logger.warning(
"ISO for %s.%s does not fit on single media! It is %s bytes too big. (Total size: %s B)"
% (variant.uid, arch, result[0]['size'] - split_size, result[0]['size'])
)
return result

View File

@ -50,7 +50,7 @@ class CreateisoPhaseTest(helpers.PungiTestCase):
self.assertEqual(pool.queue_put.call_args_list, [])
six.assertCountEqual(
self,
phase.logger.warn.call_args_list,
phase.logger.warning.call_args_list,
[mock.call('No RPMs found for Everything.x86_64, skipping ISO'),
mock.call('No RPMs found for Everything.amd64, skipping ISO'),
mock.call('No RPMs found for Everything.src, skipping ISO'),
@ -838,7 +838,7 @@ class SplitIsoTest(helpers.PungiTestCase):
os.path.join(base_path, 'Packages/b/bash.rpm')],
'size': 5400166400}])
self.assertEqual(
compose._logger.warn.call_args_list,
compose._logger.warning.call_args_list,
[mock.call('ISO for Server.x86_64 does not fit on single media! '
'It is 710652160 bytes too big. (Total size: 5400166400 B)')]
)