Skip to content

Commit

Permalink
version 5.0.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rajeevkallur committed Apr 19, 2024
1 parent 7d6db34 commit 491c004
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/redfish/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
""" Redfish restful library """

__all__ = ["rest", "ris", "hpilo"]
__version__ = "4.9.0.0"
__version__ = "5.0.0.0"

import logging

Expand Down
6 changes: 2 additions & 4 deletions src/redfish/hpilo/risblobstore2.py
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@ def initializecreds(username=None, password=None, log_dir=None):

dll = BlobStore2.gethprestchifhandle()
if LOGGER.isEnabledFor(logging.DEBUG):
logdir_c = create_string_buffer(log_dir.encode('UTF-8'))
logdir_c = create_string_buffer(log_dir.encode('utf-8'))
dll.enabledebugoutput(logdir_c)
dll.ChifInitialize(None)
if username:
Expand All @@ -925,16 +925,14 @@ def initializecreds(username=None, password=None, log_dir=None):
usernew = create_string_buffer(username.encode("utf-8"))
passnew = create_string_buffer(password.encode("utf-8"))

# LOGGER.debug("Calling initiate_credentials...")
dll.initiate_credentials(usernew, passnew)
# LOGGER.debug("Calling ChifVerifyCredentials...")
credreturn = dll.ChifVerifyCredentials()
if not credreturn == BlobReturnCodes.SUCCESS:
if credreturn == hpiloreturncodes.CHIFERR_AccessDenied:
raise Blob2SecurityError()
else:
raise HpIloInitialError(
"Error %s occurred while trying " "to open a channel to iLO" % credreturn
"Error %s occurred while trying to open a channel to iLO" % credreturn
)
else:
dll.ChifDisableSecurity()
Expand Down
9 changes: 7 additions & 2 deletions src/redfish/rest/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,9 @@ def rest_request(self, path="", method="GET", args=None, body=None, headers=None
if isinstance(body, bytes):
body = body.decode("utf-8")
body = json.dumps(body)
elif isinstance(body, bytes):
headers["Content-Type"] = "application/octet-stream"
body = bytearray(body)
else:
headers["Content-Type"] = "application/x-www-form-urlencoded"
body = urlencode(body)
Expand Down Expand Up @@ -495,12 +498,14 @@ def rest_request(self, path="", method="GET", args=None, body=None, headers=None

if body and len(body) > 0:
if isinstance(body, bytearray):
str1 = bytearray(str1.encode("ASCII")) + body
str1 = bytearray(str1.encode("utf-8")) + body
else:
#if isinstance(body, bytes):
# body = body.decode("utf-8")
str1 += body

if not isinstance(str1, bytearray):
str1 = bytearray(str1.encode("ASCII"))
str1 = bytearray(str1.encode("utf-8"))

if LOGGER.isEnabledFor(logging.DEBUG):
try:
Expand Down
3 changes: 3 additions & 0 deletions src/redfish/rest/containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,11 @@ def __init__(self, rest_request, resp_txt):
resp_txt = "".join(map(chr, resp_txt))
self._respfh = StringIO(resp_txt)
self._socket = _FakeSocket(bytearray(list(map(ord, self._respfh.read()))))
#self._respfh = BytesIO(resp_txt.encode('utf-8'))
#self._socket = _FakeSocket(bytearray(self._respfh.read()))

response = http_client.HTTPResponse(self._socket)
#response = response.decode('utf-8')
response.begin()
response.data = response.read()
response.headers = {ki[0]: ki[1] for ki in response.getheaders()}
Expand Down

0 comments on commit 491c004

Please sign in to comment.