mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 11:21:25 -07: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:
parent
a47edc9968
commit
d8536e47d3
5 changed files with 57 additions and 13 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue