Skip to content

Commit

Permalink
added pretty error-message for ssl-verification failure
Browse files Browse the repository at this point in the history
  • Loading branch information
ansibleguy committed Jan 15, 2024
1 parent 2e7f4f5 commit c7e66b2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions plugins/module_utils/helper/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,4 +195,8 @@ def api_pretty_exception(method: str, url: str, error) -> ConnectionError:
if str(error).find('timed out') != -1:
msg = f"Got timeout calling '{call}'!"

if str(error).find('CERTIFICATE_VERIFY_FAILED') != -1 or str(error).find('certificate verify failed') != -1:
msg = f"SSL verification failed '{url}'! Make sure to follow the the documentation: "\
"https://opnsense.ansibleguy.net/en/latest/usage/2_basic.html#ssl-certificate"

return ConnectionError(msg)

0 comments on commit c7e66b2

Please sign in to comment.