commit:     5a5bd751ad28317cc60754d1e874f82240daa2a1
Author:     Florian Schmaus <flow <AT> gentoo <DOT> org>
AuthorDate: Fri Sep  8 07:56:59 2023 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Fri Sep  8 12:12:20 2023 +0000
URL:        
https://gitweb.gentoo.org/proj/pkgcore/pkgdev.git/commit/?id=5a5bd751

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 <flow <AT> gentoo.org>
Closes: https://github.com/pkgcore/pkgdev/pull/158
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 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)

Reply via email to