Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added check for SubjectAltNameWarning exception in distributed_cleanup.py (3.18) #2913

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions templates/federated_reporting/nova_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,15 @@ def __init__(
basic_auth="{}:{}".format(self._api_user, self._api_password)
)
self._headers["Content-Type"] = "application/json"
# In order to avoid SubjectAltNameWarning with our self-signed certs, silence it
if not sys.warnoptions:
import warnings

warnings.simplefilter(
"ignore", category=urllib3.exceptions.SubjectAltNameWarning
)
# urllib3 v2.0 removed SubjectAltNameWarning and instead throws an error if no SubjectAltName is present in a certificate
if hasattr(urllib3.exceptions, "SubjectAltNameWarning"):
# if urllib3 is < v2.0 then SubjectAltNameWarning will exist and should be silenced
if not sys.warnoptions:
import warnings

warnings.simplefilter(
"ignore", category=urllib3.exceptions.SubjectAltNameWarning
)

def __str__(self):
return str(self.__class__) + ":" + str(self.__dict__)
Expand Down
Loading