ansible-collections / vmware.vmware_rest

Ansible Collection for VMWare (REST modules)
https://ansible-collections.github.io/vmware.vmware_rest/
GNU General Public License v3.0
131 stars 65 forks source link

content_library_item_info fails when you only specify library_id #540

Open mikemorency opened 1 week ago

mikemorency commented 1 week ago

Summary

The content_library_item_info module fails when a user specifies just the library_id. This triggers the 'list' method, which has an incorrect API url. Heres the relevant lines: https://github.com/ansible-collections/vmware.vmware_rest/blob/main/plugins/modules/content_library_item_info.py#L292-L298

As far as I can tell, the module generation is working as expected. Heres the VMware source docs: https://developer.broadcom.com/xapis/vsphere-automation-api/latest/content/api/content/library/item__library_id/get/

It currently is:

    return yarl.URL(
        ("https://{vcenter_hostname}" "/api/content/library/item?library_id").format(
            **params
        )
        + gen_args(params, _in_query_parameters),
        encoded=True,
    )

It should be:

    return yarl.URL(
        ("https://{vcenter_hostname}" "/api/content/library/item").format(
            **params
        )
        + gen_args(params, _in_query_parameters),
        encoded=True,
    )

Obviously the quick fix is a simple change. However, since the module will just be re-generated with the incorrect URL I'd like to discuss how best to fix this long term.

We could migrate the module functionality to vmware.vmware, but whats the best way to communicate this to users in this collection? Would we be able to deprecate this module with a minor release, and then remove it with a major release down the line? Is that the best course of action?

Issue Type

Feature Idea

Component Name

content_library_item_info

Additional Information

---
- name: Test Playbook
  hosts: localhost
  gather_facts: false
  tasks:
    - name: Foo
      vmware.vmware_rest.content_library_item_info:
        vcenter_validate_certs: false
        library_id: "{{ my_library_id }}"
      register: ds_lib_items_info
    - debug:
        var: ds_lib_items_info

Code of Conduct

mikemorency commented 1 week ago

@mariolenz @bardielle Id like your opinions on this please