Skip to content

Commit 8864062

Browse files
committed
bugs: require api_key earlier
The previous location for the check was after it being used in:: d.scan_existing_bugs(options.api_key) By moving the check before, we can better notify the user about the missing API key and avoid weird requests failures. Resolves: #217 Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
1 parent 14f5432 commit 8864062

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/pkgdev/scripts/pkgdev_bugs.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,10 @@ def _load_from_stdin(out: Formatter):
764764

765765
@bugs.bind_main_func
766766
def main(options, out: Formatter, err: Formatter):
767+
if options.api_key is None:
768+
err.write(out.fg("red"), "No API key provided, exiting", out.reset)
769+
return 1
770+
767771
search_repo = options.search_repo
768772
options.targets = options.targets or []
769773
d = DependencyGraph(out, err, options)
@@ -823,10 +827,6 @@ def main(options, out: Formatter, err: Formatter):
823827
):
824828
return 1
825829

826-
if options.api_key is None:
827-
err.write(out.fg("red"), "No API key provided, exiting", out.reset)
828-
return 1
829-
830830
disabled, enabled = options.auto_cc_arches
831831
blocks = list(frozenset(map(int, options.blocks)))
832832
d.file_bugs(options.api_key, frozenset(enabled).difference(disabled), blocks)

0 commit comments

Comments
 (0)