OMAM 5.4 contains issue betwen /modules/idrac_server_config_profile.wait_for_response() and /module_utils/idrac_redfish.wait_for_job_complete() where one is expecting bytes object but instead receives a string.
Issue is in idrac_server_config_profile failings on 5.4.0 in wait_for_response()->wait_resp_value = wait_resp.decode("utf-8")
# wait_resp is type string
(Pdb) wait_resp.decode('utf-8')
*** AttributeError: 'str' object has no attribute 'decode'
(Pdb) type(wait_resp)
<class 'str'>
# note string contents looks like it should be bytes object can be fixed in module_utils/idrac_redfish.py -> wait_for_job_complete by removing the str(reponse) and simplying passing response as response.body
(Pdb) wait_resp[0:5]
"b'<Sy"
# string object no decode() method
(Pdb) dir(wait_resp)
['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'capitalize', 'casefold', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'format_map', 'index', 'isalnum', 'isalpha', 'isascii', 'isdecimal', 'isdigit', 'isidentifier', 'islower', 'isnumeric', 'isprintable', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'partition', 'removeprefix', 'removesuffix', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']
Suggested Fix
Change line 229 in module_utils/idrac_redfish to the following
def wait_for_job_complete(self, task_uri, job_wait=False):
"""
This function wait till the job completion.
:param task_uri: uri to track job.
:param job_wait: True or False decide whether to wait till the job completion.
:return: object
"""
response = None
while job_wait:
try:
response = self.invoke_request(task_uri, "GET")
if response.json_data.get("TaskState") == "Running":
time.sleep(10)
else:
break
except ValueError:
response = response.body # changed from :: str(response.body)
break
return response
Invoke idrac_server_config_profile, command=export and job_wait=true
Expected Behavior
Should complete without Errors
Actual Behavior
Fails
line 505, in wait_for_response\nAttributeError: 'str' object has no attribute 'decode'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
Bug Description
Summary
OMAM 5.4 contains issue betwen /modules/idrac_server_config_profile.wait_for_response() and /module_utils/idrac_redfish.wait_for_job_complete() where one is expecting bytes object but instead receives a string.
idrac_server_config_profile - dellemc-openmanage-5.3.0.tar.gz [WORKING] idrac_server_config_profile - dellemc-openmanage-5.4.0.tar.gz [FAILING]
Details
Issue is in idrac_server_config_profile failings on 5.4.0 in wait_for_response()->wait_resp_value = wait_resp.decode("utf-8")
Suggested Fix
Change line 229 in module_utils/idrac_redfish to the following
Component or Module Name
idrac_server_config_profile
Ansible Version
Ansible 2.12.6
Python Version
Python 3.9.5
iDRAC/OME/OME-M version
SRA
Operating System
Ubuntu 21.04
Playbook Used
Logs
n/a
Steps to Reproduce
Invoke idrac_server_config_profile, command=export and job_wait=true
Expected Behavior
Should complete without Errors
Actual Behavior
Fails
line 505, in wait_for_response\nAttributeError: 'str' object has no attribute 'decode'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
Screenshots
n/a
Additional Information
No response