Uploaded image for project: 'Ansible Cloud Automation'
  1. Ansible Cloud Automation
  2. ACA-1615

[vmware.vmware_rest/372] Error: Attempt to decode JSON with unexpected mimetype

XMLWordPrintable

    • False
    • Hide

      None

      Show
      None
    • False

      https://github.com/ansible-collections/vmware.vmware_rest/issues/372

              1. SUMMARY
                Ansible Automation Private Hub is using vmware_rest collection v1.0.1
                VMware vCenter is using version 6.7U3
                When it run by module vmware.vmware_rest.vcenter_vm_info, the error return

      > ContentTypeError(\naiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html;charset=iso-8859-1', url=URL('https://X.X.X.X/api/vcenter/vm?names=XXX')

      It's seem like the issue on the url [https://github.com/ansible-collections/vmware.vmware_rest/issues/257
      ](url)

              1. ISSUE TYPE
      • Bug Report
              1. COMPONENT NAME
                vmware.vmware_rest.vcenter_vm_info
              1. ANSIBLE VERSION
                ansible [core 2.13.3]
                config file = /etc/ansible/ansible.cfg
                configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
                ansible python module location = /usr/lib/python3.9/site-packages/ansible
                ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
                executable location = /usr/bin/ansible
                python version = 3.9.13 (main, Nov 9 2022, 13:16:24) [GCC 8.5.0 20210514 (Red Hat 8.5.0-15)]
                jinja version = 3.1.2
                libyaml = True
              1. COLLECTION VERSION
                vmware.vmware_rest v1.0.1
                cloud.common v2.1.2
              1. CONFIGURATION
              1. OS / ENVIRONMENT
                Red Hat 8.7
              1. STEPS TO REPRODUCE
                Playbook:
                ```
      • name: This playbook to get VM info
        hosts: localhost
        gather_facts: false
        collections:
      • vmware.vmware_rest

      tasks:

      • name: Include Secret Environment Items
        include_vars:
        file: secrets.yml
        name: secret
      • name: Collect information about VM
        vmware.vmware_rest.vcenter_vm_info:
        vcenter_hostname: "{{ secret.vcenter }}"
        vcenter_username: "{{ secret.username }}"
        vcenter_password: "{{ secret.password }}"
        vcenter_validate_certs: no
        filter_names:
      • XXX
        ```
              1. EXPECTED RESULTS
                The result of VM
              1. ACTUAL RESULTS
                {
                "msg": [
                " File \"/usr/lib64/python3.9/runpy.py\", line 197, in _run_module_as_main\n return _run_code(code, main_globals, None,\n",
                " File \"/usr/lib64/python3.9/runpy.py\", line 87, in _run_code\n exec(code, run_globals)\n",
                " File \"/tmp/ansible_vmware.vmware_rest.vcenter_vm_info_payload_f81avl5x/ansible_vmware.vmware_rest.vcenter_vm_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/server.py\", line 382, in <module>\n",
                " File \"/tmp/ansible_vmware.vmware_rest.vcenter_vm_info_payload_f81avl5x/ansible_vmware.vmware_rest.vcenter_vm_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/server.py\", line 359, in start\n",
                " File \"/usr/lib64/python3.9/asyncio/base_events.py\", line 596, in run_forever\n self._run_once()\n",
                " File \"/usr/lib64/python3.9/asyncio/base_events.py\", line 1890, in _run_once\n handle._run()\n",
                " File \"/usr/lib64/python3.9/asyncio/events.py\", line 80, in _run\n self._context.run(self._callback, *self._args)\n",
                " File \"/tmp/ansible_vmware.vmware_rest.vcenter_vm_info_payload_f81avl5x/ansible_vmware.vmware_rest.vcenter_vm_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/server.py\", line 330, in handle\n",
                " File \"/tmp/ansible_vmware.vmware_rest.vcenter_vm_info_payload_f81avl5x/ansible_vmware.vmware_rest.vcenter_vm_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/server.py\", line 295, in run_as_module\n",
                "Traceback (most recent call last):\n File \"/tmp/ansible_vmware.vmware_rest.vcenter_vm_info_payload_f81avl5x/ansible_vmware.vmware_rest.vcenter_vm_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/server.py\", line 199, in run\n File \"/tmp/ansible_vmware.vmware_rest.vcenter_vm_info_payload_f81avl5x/ansible_vmware.vmware_rest.vcenter_vm_info_payload.zip/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_vm_info.py\", line 464, in main\n result = await entry_point(module, session)\n File \"/tmp/ansible_vmware.vmware_rest.vcenter_vm_info_payload_f81avl5x/ansible_vmware.vmware_rest.vcenter_vm_info_payload.zip/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_vm_info.py\", line 486, in entry_point\n _json = await resp.json()\n File \"/usr/local/lib64/python3.9/site-packages/aiohttp/client_reqrep.py\", line 1097, in json\n raise ContentTypeError(\naiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html;charset=iso-8859-1', url=URL('https://X.X.X.X/api/vcenter/vm?names=XXX')\n"
                ],
                "invocation":
                Unknown macro: { "module_args"}

                ,
                "_ansible_no_log": null,
                "changed": false
                }

            Unassigned Unassigned
            gosriniv@redhat.com Gomathi selvi Srinivasan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: