Closed bickfordc closed 7 months ago
Hi ,
Thanks for writing to us , we shall have a look at it .
Meanwhile could you also verify it on latest library available and let us know the result .
Thanks & Regards, Sahana
Reproduces with the latest python-ilorest-library, version 4.8.0.0
(venv) # pip list
Package Version
---------------------- -------
attrs 23.2.0
decorator 5.1.1
jsonpatch 1.33
jsonpath-rw 1.4.0
jsonpointer 2.4
pip 23.0.1
ply 3.11
python-ilorest-library 4.8.0.0
referencing 0.33.0
rpds-py 0.18.0
setuptools 66.1.1
six 1.16.0
urllib3 2.2.1
wheel 0.38.4
(venv) # python3 upload_firmware_ilo_repository.py
Traceback (most recent call last):
File "/usr/local/venv/upload_firmware_ilo_repository.py", line 111, in <module>
upload_firmware(REDFISHOBJ, FIRMWARE_PATH, UPDATE_REPO, UPDATE_TARGET)
File "/usr/local/venv/upload_firmware_ilo_repository.py", line 66, in upload_firmware
resp = _redfishobj.post(path, body, headers=header)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/venv/lib/python3.11/site-packages/redfish/rest/v1.py", line 178, in post
return self.connection.rest_request(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/venv/lib/python3.11/site-packages/redfish/rest/connections.py", line 452, in rest_request
body = json.dumps(body)
^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/json/__init__.py", line 231, in dumps
return _default_encoder.encode(obj)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/json/encoder.py", line 200, in encode
chunks = self.iterencode(o, _one_shot=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/json/encoder.py", line 258, in iterencode
return _iterencode(o, 0)
^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/json/encoder.py", line 180, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type bytes is not JSON serializable
@bickfordc This script only supports remote updates and does not support local operations. For local updates, you can use the 'ilorest' tool. To perform local updates the recommended approach is to utilize the 'ilorest' tool.
Ok thanks. I did work around the problem by using the ilorest tool, but was just hoping it would be possible to use the python-ilorest library directly. I'll close the issue.
The upload_firmware_ilo_repository.py example does not appear to work when a local connection is used. (running from the same server using the CHIF driver)
When using these lines, and commenting the other lines specifying actual system_url, account, and password:
it appears that the rest_request() method of Blobstore2Connection is hit, rather than the rest_request method of HttpConnection.
this line results in a
TypeError: Object of type bytes is not JSON serializable
from the json module. Here's a trace. I have version 3.6.0.0 installed, but it looks like there has been no change in that area anyway.Is this a known issue or am I missing something? Athough I don't thinks it's related, I did have to comment this import
from get_resource_directory import get_resource_directory
and set
resources_instances = None
because I don't have aget_resource_directory
module installed. I have the python3-ilorest package from the Debian bookworm distro, and can't easily move away from that for other reasons. Here's my upload_firmware_ilo_repository.py script: