File: 001-handle-missing-config.patch

package info (click to toggle)
python-gitlab 1%3A8.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,884 kB
  • sloc: python: 25,823; makefile: 171; ruby: 27; javascript: 3
file content (20 lines) | stat: -rw-r--r-- 776 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
From: Federico Ceratto <federico@debian.org>
Subject: Handle missing config file
Forwarded: no

Index: python-pygitlab/gitlab/cli.py
===================================================================
--- python-pygitlab.orig/gitlab/cli.py
+++ python-pygitlab/gitlab/cli.py
@@ -338,6 +338,11 @@ def main() -> None:
     try:
         config = gitlab.config.GitlabConfigParser(options.gitlab, options.config_file)
     except gitlab.config.ConfigError as e:
+        if "Impossible to get the gitlab id" in str(e):
+            sys.exit("""
+Please create a configuration file at ~/.python-gitlab.cfg
+See /usr/share/doc/gitlab-cli/examples/python-gitlab.cfg
+""")
         if "--help" in sys.argv or "-h" in sys.argv:
             parser.print_help()
             sys.exit(0)