mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
Expose timeout option to Redfish modules (#54130)
* added timeout option to Redfish modules * Apply suggestions from code review Removed 'required: false' and added 'type: int' to 'timeout' documentation string. Co-Authored-By: billdodd <billdodd@gmail.com>
This commit is contained in:
@@ -15,9 +15,10 @@ HEADERS = {'content-type': 'application/json'}
|
||||
|
||||
class RedfishUtils(object):
|
||||
|
||||
def __init__(self, creds, root_uri):
|
||||
def __init__(self, creds, root_uri, timeout):
|
||||
self.root_uri = root_uri
|
||||
self.creds = creds
|
||||
self.timeout = timeout
|
||||
self._init_session()
|
||||
return
|
||||
|
||||
@@ -29,7 +30,7 @@ class RedfishUtils(object):
|
||||
url_password=self.creds['pswd'],
|
||||
force_basic_auth=True, validate_certs=False,
|
||||
follow_redirects='all',
|
||||
use_proxy=False)
|
||||
use_proxy=False, timeout=self.timeout)
|
||||
data = json.loads(resp.read())
|
||||
except HTTPError as e:
|
||||
return {'ret': False, 'msg': "HTTP Error: %s" % e.code}
|
||||
@@ -49,7 +50,7 @@ class RedfishUtils(object):
|
||||
url_password=self.creds['pswd'],
|
||||
force_basic_auth=True, validate_certs=False,
|
||||
follow_redirects='all',
|
||||
use_proxy=False)
|
||||
use_proxy=False, timeout=self.timeout)
|
||||
except HTTPError as e:
|
||||
return {'ret': False, 'msg': "HTTP Error: %s" % e.code}
|
||||
except URLError as e:
|
||||
@@ -68,7 +69,7 @@ class RedfishUtils(object):
|
||||
url_password=self.creds['pswd'],
|
||||
force_basic_auth=True, validate_certs=False,
|
||||
follow_redirects='all',
|
||||
use_proxy=False)
|
||||
use_proxy=False, timeout=self.timeout)
|
||||
except HTTPError as e:
|
||||
return {'ret': False, 'msg': "HTTP Error: %s" % e.code}
|
||||
except URLError as e:
|
||||
@@ -87,7 +88,7 @@ class RedfishUtils(object):
|
||||
url_password=self.creds['pswd'],
|
||||
force_basic_auth=True, validate_certs=False,
|
||||
follow_redirects='all',
|
||||
use_proxy=False)
|
||||
use_proxy=False, timeout=self.timeout)
|
||||
except HTTPError as e:
|
||||
return {'ret': False, 'msg': "HTTP Error: %s" % e.code}
|
||||
except URLError as e:
|
||||
|
||||
Reference in New Issue
Block a user