Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 65abb85

Browse filesBrowse files
emanueleainanejch
authored andcommitted
fix(cli): Enable debug before doing auth
Authentication issues are currently hard to debug since `--debug` only has effect after `gl.auth()` has been called. For example, a 401 error is printed without any details about the actual HTTP request being sent: $ gitlab --debug --server-url https://gitlab.com current-user get 401: 401 Unauthorized By moving the call to `gl.enable_debug()` the usual debug logs get printed before the final error message. Signed-off-by: Emanuele Aina <emanuele.aina@collabora.com>
1 parent d8a657b commit 65abb85
Copy full SHA for 65abb85

File tree

Expand file treeCollapse file tree

1 file changed

+2
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-3
lines changed
Open diff view settings
Collapse file

‎gitlab/cli.py‎

Copy file name to clipboardExpand all lines: gitlab/cli.py
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,14 +366,13 @@ def main() -> None:
366366

367367
try:
368368
gl = gitlab.Gitlab.merge_config(vars(options), gitlab_id, config_files)
369+
if debug:
370+
gl.enable_debug()
369371
if gl.private_token or gl.oauth_token:
370372
gl.auth()
371373
except Exception as e:
372374
die(str(e))
373375

374-
if debug:
375-
gl.enable_debug()
376-
377376
gitlab.v4.cli.run(
378377
gl, gitlab_resource, resource_action, args_dict, verbose, output, fields
379378
)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.