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

[vmware.vmware_rest/356] MOID Lookup issue with Execution Environments

XMLWordPrintable

    • False
    • Hide

      None

      Show
      None
    • False

      https://github.com/ansible-collections/vmware.vmware_rest/issues/356
      <!--- Verify first that your issue is not already reported on GitHub -->
      <!--- Also test if the latest release and devel branch are affected too -->
      <!--- Complete all sections as described, this form is processed automatically -->

              1. SUMMARY
                <!--- Explain the problem briefly below -->
                When running a vmware.vmware_rest.datacenter_moid, folder_moid, or resource_pool_moid (haven't tested the other moids) lookup with an Execution Environment I get the same error repeatedly but no error when running it locally with the same collection version.

      fatal: [localhost]: FAILED! =>

      {"msg": "An unhandled exception occurred while running the lookup plugin 'vmware.vmware_rest.datastore_moid'. Error was a <class 'ansible_collections.cloud.common.plugins.module_utils.turbo.exceptions.EmbeddedModuleUnexpectedFailure'>, original message: Cannot decode plugin answer: b''. Cannot decode plugin answer: b''"}
              1. ISSUE TYPE
      • Bug Report
              1. COMPONENT NAME
                <!--- Write the short name of the module, plugin, task or feature below, use your best guess if unsure -->
                vmware.vmware_rest
              2. ANSIBLE VERSION
                <!--- Paste verbatim output from "ansible --version" between quotes -->
                ```paste below
                ansible [core 2.13.2]
                config file = /etc/ansible/ansible.cfg
                configured module search path = ['/home/ndennis/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
                ansible python module location = /home/ndennis/.local/lib/python3.8/site-packages/ansible
                ansible collection location = /home/ndennis/.ansible/collections:/usr/share/ansible/collections
                executable location = /home/ndennis/.local/bin/ansible
                python version = 3.8.10 (default, Jun 22 2022, 20:18:18) [GCC 9.4.0]
                jinja version = 3.1.2
                libyaml = True
                ```
              1. COLLECTION VERSION
                <!--- Paste verbatim output from "ansible-galaxy collection list <namespace>.<collection>" between the quotes
                for example: ansible-galaxy collection list community.general
                -->
                ```paste below
      1. /home/ndennis/.local/lib/python3.8/site-packages/ansible_collections
        Collection Version
                                        • -------
                                          vmware.vmware_rest 2.2.0
      1. /home/ndennis/.ansible/collections/ansible_collections
        Collection Version
                                        • -------
                                          vmware.vmware_rest 2.2.0
                                          ```
              1. CONFIGURATION
                <!--- Paste verbatim output from "ansible-config dump --only-changed" between quotes -->
                ```paste below

      ```

              1. OS / ENVIRONMENT
                <!--- Provide all relevant information below, e.g. target OS versions, network device firmware, etc. -->
                Ubuntu 20.04 Locally
              1. STEPS TO REPRODUCE
                <!--- Describe exactly how to reproduce the problem, using a minimal test-case -->
                Perform an MOID lookup utilizing an Execution Environment and ansible-navigator
                <!--- Paste example playbooks or commands between quotes below -->
                ```yaml
      • name: Clone the template VM
        vmware.vmware_rest.vcenter_vm:
        placement:
        datastore: "{{ lookup('vmware.vmware_rest.datastore_moid', '/test/datastore/test_1') }}"
        folder: "{{ lookup('vmware.vmware_rest.folder_moid', '/test/ansible') }}"
        resource_pool: "{{ lookup('vmware.vmware_rest.resource_pool_moid', '/test/host/General/Ansible') }}"
        source: '{{ existing_vms.value[0].vm }}'
        name: test123
        state: clone
        register: vm_output
        ```

      <!--- HINT: You can paste gist.github.com links for larger files -->

              1. EXPECTED RESULTS
                <!--- Describe what you expected to happen when running the steps above -->
                I expect to pull back the MOID and store it in the variable to use when cloning a VM.
              1. ACTUAL RESULTS
                <!--- Describe what actually happened. If possible run with extra verbosity (-vvvv) -->
                Instead I get the below error and the playbook stops:
                <!--- Paste verbatim command output between quotes -->
                ```paste below
                Loading collection cloud.common from /usr/share/ansible/collections/ansible_collections/cloud/common
                exception during Jinja2 execution: Traceback (most recent call last):
                File "/usr/share/ansible/collections/ansible_collections/cloud/common/plugins/module_utils/turbo/common.py", line 106, in communicate
                result = json.loads(raw_answer.decode())
                File "/usr/lib64/python3.9/json/_init_.py", line 346, in loads
                return _default_decoder.decode(s)
                File "/usr/lib64/python3.9/json/decoder.py", line 337, in decode
                obj, end = self.raw_decode(s, idx=_w(s, 0).end())
                File "/usr/lib64/python3.9/json/decoder.py", line 355, in raw_decode
                raise JSONDecodeError("Expecting value", s, err.value) from None
                json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
      File "/usr/lib/python3.9/site-packages/ansible/template/_init_.py", line 984, in _lookup
      ran = instance.run(loop_terms, variables=self._available_variables, **kwargs)
      File "/usr/share/ansible/collections/ansible_collections/cloud/common/plugins/plugin_utils/turbo/lookup.py", line 58, in run_on_daemon
      return self.execute(terms=terms, variables=variables, **kwargs)
      File "/usr/share/ansible/collections/ansible_collections/cloud/common/plugins/plugin_utils/turbo/lookup.py", line 88, in execute
      (result, errors) = turbo_socket.communicate(content)
      File "/usr/share/ansible/collections/ansible_collections/cloud/common/plugins/module_utils/turbo/common.py", line 109, in communicate
      raise EmbeddedModuleUnexpectedFailure(
      ansible_collections.cloud.common.plugins.module_utils.turbo.exceptions.EmbeddedModuleUnexpectedFailure: Cannot decode plugin answer: b''
      fatal: [localhost]: FAILED! =>

      { "msg": "An unhandled exception occurred while running the lookup plugin 'vmware.vmware_rest.datastore_moid'. Error was a <class 'ansible_collections.cloud.common.plugins.module_utils.turbo.exceptions.EmbeddedModuleUnexpectedFailure'>, original message: Cannot decode plugin answer: b''. Cannot decode plugin answer: b''" }

      ```

            gleboude1@redhat.com Gonéri Le Bouder
            jrouleau Jill Rouleau
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: