oVirt / ovirt-ansible-collection

Ansible collection with official oVirt modules and roles
72 stars 91 forks source link

ovirt_vm_info fails with "The response content type 'text/html;charset=UTF-8' isn't the expected XML" #407

Open jangel97 opened 2 years ago

jangel97 commented 2 years ago

Summary

Hi, module _ovirt_vminfo is failing with error: The response content type 'text/html;charset=UTF-8' isn't the expected XML.

Environment:

Python version: 3.6.8
Ansible version: 2.9.11
ovirt-engine-sdk-python version: 4.4.14 

My RHV instance has digital certificate expired. Even though,ovirt_auth has entry insecure set to true the error is still happening. Is this a bug? Or is it something I am missing?

Steps to reproduce

   - name: Authenticating to RHV at {{ rhv_host }}
     ovirt_auth:
       url: "https://{{ rhv_host }}/ovirt-engine/api"
       insecure: true
       kerberos: true
    - name: Get all rhv vms
      ovirt_vm_info:
        auth: "{{ ovirt_auth }}"
      register: all_rhv_vms

Problem

I would expect the previous code to run successfully (even with the RHV instance with cert epired), but I am finding the following error:

The response content type 'text/html;charset=UTF-8' isn't the expected XML

Is this a bug? Could it be that I am missing something? If this is a bug, is there something I can do to bypass it temporarily?

Thanks in advance,

mnecas commented 2 years ago

HI, are you sure that the Kerberos login is working? The error which you got is because the engine does not return the XML. Could you try logging into the engine with a python api/curl request? (I'm thinking to implement better logging for these errors.)

mohanrajb9 commented 11 months ago

Getting similar error when run through ovirt module ovirtsdk4.Error: The response content type 'text/html; charset=utf-8' isn't the expected JSON When I tried to hit the API with curl and getting this error

[dev@tm ~]$ curl --cacert ca.crt --request GET --header 'Version: 4' --header 'Accept: application/xml' --user 'user@internal:***' https://olvm-domain1/ovirt-engine/api -k

Curl response:

Network Error Network Error (dns_unresolved_hostname) ... Your requested host "olvm-domain1" could not be resolved by DNS. ...

But I could able to ping olvm-domain1 good from the host tm.

How to fix this issue?