[elbe-devel] [PATCH] elbepack: cdroms: log encountered exceptions
Thomas Weißschuh
thomas.weissschuh at linutronix.de
Tue Jan 14 17:37:15 CET 2025
If the download fails due to an exception that should be reported to the
user so they can handle or fix the issue.
As all logging happens while an exception is active, logging.exception()
provides this information conveniently.
The same exception logging already exists in elbepack.finetuning and
elbepack.commands.fetch_initvm_pkgs.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
elbepack/cdroms.py | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/elbepack/cdroms.py b/elbepack/cdroms.py
index c28cae90bc3ea1abd92ace7332b6854d58c6fb53..a2f139a27e7555433190b4815086919af0277051 100644
--- a/elbepack/cdroms.py
+++ b/elbepack/cdroms.py
@@ -31,9 +31,9 @@ def add_source_pkg(repo, component, cache, pkg, version, forbid):
'/var/cache/elbe/sources')
repo.includedsc(dsc, components=component, force=True)
except ValueError as e:
- logging.error("No sources for package '%s': %s", pkg_id, str(e))
+ logging.exception("No sources for package '%s': %s", pkg_id, str(e))
except FetchError as e:
- logging.error("Source for package '%s' could not be downloaded: %s", pkg_id, str(e))
+ logging.exception("Source for package '%s' could not be downloaded: %s", pkg_id, str(e))
def mk_source_cdrom(components, codename,
@@ -172,11 +172,11 @@ def mk_binary_cdrom(rfs, arch, codename, init_codename, xml, target):
pkg.installed_version)
target_repo.includedeb(deb, 'main', prio=pkg.installed_prio)
except ValueError:
- logging.error("No package '%s'", pkg_id)
+ logging.exception("No package '%s'", pkg_id)
except FetchError:
- logging.error("Package '%s' could not be downloaded", pkg_id)
+ logging.exception("Package '%s' could not be downloaded", pkg_id)
except TypeError:
- logging.error("Package '%s' missing name or version", pkg_id)
+ logging.exception("Package '%s' missing name or version", pkg_id)
cache = get_rpcaptcache(rfs, arch)
pkglist = cache.get_installed_pkgs()
@@ -188,13 +188,13 @@ def mk_binary_cdrom(rfs, arch, codename, init_codename, xml, target):
pkg.installed_version)
target_repo.includedeb(deb, 'added', pkg.name, prio=pkg.installed_prio, force=True)
except KeyError as ke:
- logging.error(str(ke))
+ logging.exception(str(ke))
except ValueError:
- logging.error("No package '%s'", pkg_id)
+ logging.exception("No package '%s'", pkg_id)
except FetchError:
- logging.error("Package '%s' could not be downloaded", pkg_id)
+ logging.exception("Package '%s' could not be downloaded", pkg_id)
except TypeError:
- logging.error("Package '%s' missing name or version", pkg_id)
+ logging.exception("Package '%s' missing name or version", pkg_id)
target_repo.finalize()
---
base-commit: 53f7126e9dbbf2934376cb08eb71fba54dacbe23
change-id: 20250114-cdrom-exception-8fe8d8d15834
Best regards,
--
Thomas Weißschuh <thomas.weissschuh at linutronix.de>
More information about the elbe-devel
mailing list