Modify incompatible default value passed to requests

This commit fixes incompatibility imported in
274dca0344 which
changes default value passed to requests module function.

Change-Id: I67663e6bd6e060f572e9c26cf504abd31ba49402
(cherry picked from commit 56273075aa)
(cherry picked from commit ee4eb0d315)
(cherry picked from commit 2d39c4d91f)
This commit is contained in:
Vanou Ishii 2022-07-29 17:01:52 +09:00
parent 0f50c986e7
commit cd4b53b95b
3 changed files with 13 additions and 12 deletions

View File

@ -191,7 +191,7 @@ def elcm_request(irmc_info, method, path, **kwargs):
'irmc_verify_ca': Either a boolean, in which case it controls
whether we verify the server's TLS certificate,
or a string, in which case it must be a path to
a CA bundle to use. Defaults to ``True``.
a CA bundle to use. Defaults to ``False``.
...
}
:param method: request method such as 'GET', 'POST'
@ -207,7 +207,7 @@ def elcm_request(irmc_info, method, path, **kwargs):
userid = irmc_info['irmc_username']
password = irmc_info['irmc_password']
client_timeout = irmc_info.get('irmc_client_timeout', 60)
verify = irmc_info.get('irmc_verify_ca', True)
verify = irmc_info.get('irmc_verify_ca', False)
# Request headers, params, and data
headers = kwargs.get('headers', {'Accept': 'application/json'})

View File

@ -247,7 +247,7 @@ def get_share_type(share_type):
def scci_cmd(host, userid, password, cmd, port=443, auth_method='basic',
client_timeout=60, do_async=True, verify=True, **kwargs):
client_timeout=60, do_async=True, verify=False, **kwargs):
"""execute SCCI command
This function calls SCCI server modules
@ -262,7 +262,7 @@ def scci_cmd(host, userid, password, cmd, port=443, auth_method='basic',
:param verify: (optional) Either a boolean, in which case it
controls whether we verify the server's TLS certificate,
or a string, in which case it must be a path to
a CA bundle to use. Defaults to ``True``.
a CA bundle to use. Defaults to ``False``.
:returns: requests.Response from SCCI server
:raises: SCCIInvalidInputError if port and/or auth_method params
are invalid
@ -348,7 +348,7 @@ def scci_cmd(host, userid, password, cmd, port=443, auth_method='basic',
def get_client(host, userid, password, port=443, auth_method='basic',
client_timeout=60, verify=True, **kwargs):
client_timeout=60, verify=False, **kwargs):
"""get SCCI command partial function
This function returns SCCI command partial function
@ -361,7 +361,7 @@ def get_client(host, userid, password, port=443, auth_method='basic',
:param verify: (optional) Either a boolean, in which case it
controls whether we verify the server's TLS certificate,
or a string, in which case it must be a path to
a CA bundle to use. Defaults to ``True``.
a CA bundle to use. Defaults to ``False``.
:returns: scci_cmd partial function which takes a SCCI command param
"""
@ -435,7 +435,7 @@ def get_virtual_fd_set_params_cmd(remote_image_server,
def get_report(host, userid, password,
port=443, auth_method='basic', client_timeout=60, verify=True):
port=443, auth_method='basic', client_timeout=60, verify=False):
"""get iRMC report
This function returns iRMC report in XML format
@ -448,7 +448,7 @@ def get_report(host, userid, password,
:param verify: (optional) Either a boolean, in which case it
controls whether we verify the server's TLS certificate,
or a string, in which case it must be a path to
a CA bundle to use. Defaults to ``True``.
a CA bundle to use. Defaults to ``False``.
:returns: root element of SCCI report
:raises: ISCCIInvalidInputError if port and/or auth_method params
are invalid
@ -694,8 +694,9 @@ def get_firmware_upgrade_status(irmc_info, upgrade_type):
'irmc_client_timeout': timeout, default is 60,
'irmc_verify_ca': (optional) Either a boolean, in which case it
controls whether we verify the server's TLS
certificate, or a string, in which case it must be
a path to a CA bundle to use. Defaults to ``True``.
certificate, or a string, in which case it
must be a path to a CA bundle to use.
Defaults to ``False``.
...
}
:param upgrade_type: flag to check upgrade with bios or irmc
@ -710,7 +711,7 @@ def get_firmware_upgrade_status(irmc_info, upgrade_type):
port = irmc_info.get('irmc_port', 443)
auth_method = irmc_info.get('irmc_auth_method', 'digest')
client_timeout = irmc_info.get('irmc_client_timeout', 60)
verify = irmc_info.get('irmc_verify_ca', True)
verify = irmc_info.get('irmc_verify_ca', False)
auth_obj = None
try:

View File

@ -131,7 +131,7 @@ class SCCITestCase(testtools.TestCase):
'https://' + self.irmc_address + '/config',
data=scci.POWER_ON,
headers={'Content-type': 'application/x-www-form-urlencoded'},
verify=True,
verify=False,
timeout=self.irmc_client_timeout,
allow_redirects=False,
auth=mock_requests.auth.HTTPBasicAuth(self.irmc_username,