From 5a5bd751ad28317cc60754d1e874f82240daa2a1 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Fri, 8 Sep 2023 09:56:59 +0200 Subject: pkgdev_bugs: do not swallow exceptions when reading ~/.bugz_token In case the file is not readable, or other issues, do not swallow the exception. Signed-off-by: Florian Schmaus Closes: https://github.com/pkgcore/pkgdev/pull/158 Signed-off-by: Arthur Zamarin --- src/pkgdev/scripts/pkgdev_bugs.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pkgdev/scripts/pkgdev_bugs.py b/src/pkgdev/scripts/pkgdev_bugs.py index 26f77c5..c89d1c8 100644 --- a/src/pkgdev/scripts/pkgdev_bugs.py +++ b/src/pkgdev/scripts/pkgdev_bugs.py @@ -546,8 +546,9 @@ def main(options, out: Formatter, err: Formatter): node.cleanup_keywords(search_repo) if options.api_key is None: - with contextlib.suppress(Exception): - options.api_key = (Path.home() / ".bugz_token").read_text().strip() or None + bugz_token_file = Path.home() / ".bugz_token" + if bugz_token_file.is_file: + options.api_key = bugz_token_file.read_text().strip() if not d.nodes: out.write(out.fg("red"), "Nothing to do, exiting", out.reset) -- cgit v1.2.3-65-gdbad