Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An error occurs when using vmware_guest_info by enabling the tags option. #403

Closed
sky-joker opened this issue Sep 27, 2020 · 1 comment · Fixed by #406
Closed

An error occurs when using vmware_guest_info by enabling the tags option. #403

sky-joker opened this issue Sep 27, 2020 · 1 comment · Fixed by #406
Labels
bug This issue/PR relates to a bug has_pr

Comments

@sky-joker
Copy link
Collaborator

sky-joker commented Sep 27, 2020

SUMMARY

I tried to execute a playbook that true the tags option, the following error occurs.

The full traceback is:
  File "/tmp/ansible_community.vmware.vmware_guest_info_payload_p7dnphwz/ansible_community.vmware.vmware_guest_info_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_guest_info.py", line 299, in main
  File "/tmp/ansible_community.vmware.vmware_guest_info_payload_p7dnphwz/ansible_community.vmware.vmware_guest_info_payload.zip/ansible_collections/community/vmware/plugins/module_utils/vmware_rest_client.py", line 274, in get_vm_tags
    dobj=vm_mid
  File "/tmp/ansible_community.vmware.vmware_guest_info_payload_p7dnphwz/ansible_community.vmware.vmware_guest_info_payload.zip/ansible_collections/community/vmware/plugins/module_utils/vmware_rest_client.py", line 172, in get_tags_for_object
    tag_ids = tag_assoc_svc.list_attached_tags(dobj)
  File "/root/stackoverflow/60307702/venv/lib64/python3.6/site-packages/com/vmware/cis/tagging_client.py", line 1415, in list_attached_tags
    'object_id': object_id,
  File "/root/stackoverflow/60307702/venv/lib64/python3.6/site-packages/vmware/vapi/bindings/stub.py", line 345, in _invoke
    return self._api_interface.native_invoke(ctx, _method_name, kwargs)
  File "/root/stackoverflow/60307702/venv/lib64/python3.6/site-packages/vmware/vapi/bindings/stub.py", line 230, in native_invoke
    self._rest_converter_mode)
  File "/root/stackoverflow/60307702/venv/lib64/python3.6/site-packages/vmware/vapi/bindings/converter.py", line 1117, in convert_to_vapi
    binding_type.accept(visitor)
  File "/root/stackoverflow/60307702/venv/lib64/python3.6/site-packages/vmware/vapi/bindings/type.py", line 40, in accept
    visitor.visit(self)
  File "/root/stackoverflow/60307702/venv/lib64/python3.6/site-packages/vmware/vapi/lib/visitor.py", line 43, in visit
    return method(value)
  File "/root/stackoverflow/60307702/venv/lib64/python3.6/site-packages/vmware/vapi/bindings/converter.py", line 327, in visit_struct
    self._visit_python_dict(typ)
  File "/root/stackoverflow/60307702/venv/lib64/python3.6/site-packages/vmware/vapi/bindings/converter.py", line 306, in _visit_python_dict
    self.visit(field_type)
  File "/root/stackoverflow/60307702/venv/lib64/python3.6/site-packages/vmware/vapi/lib/visitor.py", line 43, in visit
    return method(value)
  File "/root/stackoverflow/60307702/venv/lib64/python3.6/site-packages/vmware/vapi/bindings/converter.py", line 434, in visit_reference
    self.visit(typ.resolved_type)
  File "/root/stackoverflow/60307702/venv/lib64/python3.6/site-packages/vmware/vapi/lib/visitor.py", line 43, in visit
    return method(value)
  File "/root/stackoverflow/60307702/venv/lib64/python3.6/site-packages/vmware/vapi/bindings/converter.py", line 333, in visit_struct
    raise CoreException(msg)
fatal: [localhost]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "datacenter": "DC",
            "folder": null,
            "hostname": "vcenterhostname",
            "moid": null,
            "name": "test_vm1",
            "name_match": "first",
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "port": 443,
            "properties": null,
            "proxy_host": null,
            "proxy_port": null,
            "schema": "summary",
            "tags": true,
            "use_instance_uuid": false,
            "username": "[email protected]",
            "uuid": null,
            "validate_certs": false
        }
    },
    "msg": "Information gathering failed with exception Expected VapiStruct instance or python dictionary, but received str"
}

Ansible 2.9 had not the above error.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

plugins/modules/vmware_guest_info.py

ANSIBLE VERSION
# ansible --version
ansible 2.10.1
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /root/stackoverflow/60307702/venv/lib64/python3.6/site-packages/ansible
  executable location = /root/stackoverflow/60307702/venv/bin/ansible
  python version = 3.6.8 (default, Aug  7 2019, 17:28:10) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
CONFIGURATION
# ansible-config dump --only-changed
OS / ENVIRONMENT
  • vCenter/ESXi 7.0
  • pyvmomi 7.0
  • vSphere-Automation-SDK 1.37.0
  • VMware collection latest
STEPS TO REPRODUCE

I created the following playbook, and it executed.

---
- name: test
  hosts: localhost
  gather_facts: false
  vars:
    vcenter_hostname: vcenterhostname
    vcenter_username: [email protected]
    vcenter_password: secret
    dc1: DC
    vm_name: test_vm1
  tasks:
    - name: test
      community.vmware.vmware_guest_info:
        hostname: "{{ vcenter_hostname }}"
        username: "{{ vcenter_username }}"
        password: "{{ vcenter_password }}"
        validate_certs: false
        datacenter: "{{ dc1 }}"
        name: "{{ vm_name }}"
        tags: true
      register: r

    - debug: var=r
EXPECTED RESULTS

Gather tags and summary information for specified VM.

ACTUAL RESULTS

The error occurred.

Akasurde added a commit to Akasurde/community.vmware that referenced this issue Sep 28, 2020
@Akasurde
Copy link
Member

resolved_by_pr #406

@Akasurde Akasurde added bug This issue/PR relates to a bug has_pr labels Sep 28, 2020
Akasurde added a commit to Akasurde/community.vmware that referenced this issue Sep 29, 2020
Akasurde added a commit to Akasurde/community.vmware that referenced this issue Sep 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug has_pr
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants