← Back to team overview

sts-sponsors team mailing list archive

[Merge] ~troyanov/maas:add-sslerror-reason into maas:master

 

Anton Troyanov has proposed merging ~troyanov/maas:add-sslerror-reason into maas:master.

Commit message:
chore(cli): print SSLError.reason


Requested reviews:
  MAAS Maintainers (maas-maintainers)

For more details, see:
https://code.launchpad.net/~troyanov/maas/+git/maas/+merge/439110

Since SSL might fail due to variety of reasons, returning `SSLError.reason` will be helpful for troubleshooting.  
-- 
Your team MAAS Maintainers is requested to review the proposed merge of ~troyanov/maas:add-sslerror-reason into maas:master.
diff --git a/src/maascli/api.py b/src/maascli/api.py
index 7196977..817d6f8 100644
--- a/src/maascli/api.py
+++ b/src/maascli/api.py
@@ -49,10 +49,10 @@ def http_request(
         if isinstance(url, bytes):
             url = url.decode("ascii")
         return http.request(url, method, body=body, headers=headers)
-    except httplib2.ssl.SSLError:
+    except httplib2.ssl.SSLError as error:
         raise CommandError(
-            "Certificate verification failed, use --insecure/-k to "
-            "disable the certificate check."
+            f"Certificate verification failed, use --insecure/-k to" +
+            f"disable the certificate check.\nSSLError: {error.reason}"
         )
 
 

Follow ups