# plugins/modules/iso.py
with open(module.params["source"], "rb") as source_file:
rest_client.put_record(
endpoint="/rest/v1/ISO/%s/data" % iso_uuid,
Something like https://github.com/ScaleComputing/HyperCoreAnsibleCollection/tree/bug-iso might be a fix.
From memory, ISO (and virtual disks in near future) are the only objects where we upload binary data.
I'm not sure if we can have something nicer than that commit. What I really do not like, is that:
we return a TaskTag with invalid values inside. Maybe better None?
json.JSONDecodeError was not intercepted, we get json.decoder.JSONDecodeError instead. Might depend on ansible version. Better to except (json.JSONDecodeError, json.decoder.JSONDecodeError): ?
Describe the bug
Uploading ISO image fails (ISO must not be on server before) with
msg: 'Received invalid JSON response: b''success'''
To Reproduce
Bisection - main@ aeb4eab4b026d5d4fc884142aa9930aed0fb52ec works, main@ b71efe31834ee01bf7c5abfe865b22799dfced0d does not.
Expected behavior
ISO should be uploaded
System Info (please complete the following information):
Additional context
Failure is at
Something like https://github.com/ScaleComputing/HyperCoreAnsibleCollection/tree/bug-iso might be a fix. From memory, ISO (and virtual disks in near future) are the only objects where we upload binary data. I'm not sure if we can have something nicer than that commit. What I really do not like, is that:
None
?json.JSONDecodeError
was not intercepted, we getjson.decoder.JSONDecodeError
instead. Might depend on ansible version. Better toexcept (json.JSONDecodeError, json.decoder.JSONDecodeError):
?