ScaleComputing / HyperCoreAnsibleCollection

Official Ansible collection for Scale Computing SC//HyperCore (HC3) v1 API
GNU General Public License v3.0
12 stars 8 forks source link

:lady_beetle: Bug: ISO upload #165

Closed justinc1 closed 1 year ago

justinc1 commented 1 year ago

Describe the bug

Uploading ISO image fails (ISO must not be on server before) with msg: 'Received invalid JSON response: b''success'''

To Reproduce

# remove the ISO 
# main at b3706ce75c1d430372cdccd1ddc8730e26086402
ansible-playbook -i localhost, examples/iso.yml -e iso_remove_old_image=true
TASK [(Optionally) remove existing ISO TinyCore-current.iso from HyperCore] **********************************************************************************
changed: [localhost]

TASK [Upload ISO TinyCore-current.iso to HyperCore] **********************************************************************************************************
fatal: [localhost]: FAILED! => changed=false 
  msg: 'Received invalid JSON response: b''success'''

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

# 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: