ngine-io / ansible-collection-cloudstack

CloudStack Ansible Collections
https://galaxy.ansible.com/ngine_io/cloudstack
GNU General Public License v3.0
21 stars 27 forks source link

Module cs_sshkeypair throws error CloudStackException: JSON (application/json) was expected, got 'text/html; charset=utf-8' #95

Closed John222 closed 2 years ago

John222 commented 2 years ago

Hello guys

we found an issue with the ngine_io.cloudstack.cs_sshkeypair module. When we trying to use it, it throws the following error.

CloudStackException: JSON (application/json) was expected, got 'text/html; charset=utf-8'

as API URL we entered https://api.exoscale.ch. We also tried with the url https://api.exoscale.com.

Looks like exoscale changed the required header, which needs to be passed to the requests.

resmo commented 2 years ago

Hi @John222

You got an unexpected html response from the endpoint,

looking at the endpoint this should be either https://api.exoscale.com/v1 or https://api.exoscale.com/compute. You can actually open this in your browser to check, the response should look like

{"errorresponse":{"errorcode":401,"cserrorcode":9999,"errortext":"unable to verify user credentials and/or request signature","uuidList":[]}}
John222 commented 2 years ago

Thank you for the quick reply. I'll try it out and come back to you. 👍😃

resmo commented 2 years ago

That said, you reminded me to publish my role for managing exoscale resources. Long overdue. Expect it to be released today.

John222 commented 2 years ago

Hello Rene. It worked. Thank you for the hint. :).

resmo commented 2 years ago

@John222 --> https://galaxy.ansible.com/ngine_io/exoscale_compute