Skip to content

Commit

Permalink
Disable insecure request warning
Browse files Browse the repository at this point in the history
In order to check whether a RMT server is responsive,
a https request is triggered with verification disable
making the request to show a warning

Disable warning for registercloudguest and SMT class

This PR silences that warning
  • Loading branch information
jesusbv committed May 14, 2024
1 parent 1b973a4 commit 7517d6e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/cloudregister/registerutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@
REGISTERED_SMT_SERVER_DATA_FILE_NAME = 'currentSMTInfo.obj'
RMT_AS_SCC_PROXY_MARKER = 'rmt_is_scc_proxy'

requests.packages.urllib3.disable_warnings(
requests.packages.urllib3.exceptions.InsecureRequestWarning
)


# ----------------------------------------------------------------------------
def add_hosts_entry(smt_server):
Expand Down Expand Up @@ -505,9 +509,6 @@ def get_credentials(credentials_file):
# ----------------------------------------------------------------------------
def refresh_registry_credentials():
"""Refresh registry credentials."""
# to silence InsecureRequestWarning
# should be fixed on a different PR
requests.packages.urllib3.disable_warnings()
return get_activations()


Expand Down
6 changes: 6 additions & 0 deletions lib/cloudregister/smt.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ def __init__(self, smtXMLNode, https_only=False):
if https_only:
self._protocol = 'https'
self._check_urls = self._form_srv_check_urls()
# disable InsecureRequestWarning
# as verification is disabled for the https request
requests.packages.urllib3.disable_warnings(
requests.packages.urllib3.exceptions.InsecureRequestWarning
)


# --------------------------------------------------------------------
def __eq__(self, other_smt):
Expand Down

0 comments on commit 7517d6e

Please sign in to comment.