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

vmware_guest_info: Fix get tags API call #406

Merged
merged 1 commit into from
Sep 29, 2020

Conversation

Akasurde
Copy link
Member

SUMMARY

Fixes: #403

Signed-off-by: Abhijeet Kasurde [email protected]

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

plugins/modules/vmware_guest_info.py
tests/integration/targets/vmware_tag/tasks/tag_manager_ops.yml

@sky-joker
Copy link
Collaborator

sky-joker commented Sep 28, 2020

Thank you @Akasurde for this patch :)
Doesn’t this PR add a changelog file?
I wonder doesn’t it need it because of a small patch?

@sky-joker
Copy link
Collaborator

sky-joker commented Sep 28, 2020

I confirmed the bug fixed module worked with my test environment and Ansible 2.10.
By the way, I checked an output was changed for tags information the following.

Used test task

    - name: Gather VM information
      vmware_guest_info:
        hostname: "{{ vcenter_hostname }}"
        username: "{{ vcenter_username }}"
        password: "{{ vcenter_password }}"
        validate_certs: no
        datacenter: "{{ dc1 }}"
        name: "{{ vm_name }}"
        tags: true
      register: vm_info_result

    - debug: var=vm_info_result.instance.tags

When Ansible 2.9

ok: [localhost] => {
    "vm_info_result.instance.tags": [
        "ex_tag01"
    ]
}

When using the bug fixed module by Ansible 2.10

ok: [localhost] => {
    "vm_info_result.instance.tags": [
        {
            "category_id": "urn:vmomi:InventoryServiceCategory:4f21b167-e11b-43ae-a920-63972642a7e0:GLOBAL",
            "category_name": "test",
            "description": "",
            "id": "urn:vmomi:InventoryServiceTag:826f26c1-ab95-4c34-a9bb-17235a9a7874:GLOBAL",
            "name": "ex_tag01"
        }
    ]
}

Is this correct?

@Akasurde
Copy link
Member Author

@sky-joker Yes, you are right. There is a change in the output of both APIs. I am now returning a list of tags just like 2.9.

Thanks for noticing.

Copy link
Collaborator

@sky-joker sky-joker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :)

@sky-joker sky-joker added the gate label Sep 29, 2020
@ansible-zuul ansible-zuul bot merged commit a92ccb0 into ansible-collections:main Sep 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

An error occurs when using vmware_guest_info by enabling the tags option.
2 participants