|
|
|
|
@ -19,9 +19,10 @@ DELETE_HEADERS = {'accept': 'application/json', 'OData-Version': '4.0'}
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
@ -33,7 +34,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}
|
|
|
|
|
@ -52,7 +53,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:
|
|
|
|
|
@ -70,7 +71,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:
|
|
|
|
|
@ -88,7 +89,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:
|
|
|
|
|
|