vultr / ansible-collection-vultr

GNU General Public License v3.0
28 stars 17 forks source link

[BUG] - module "reserved_ip" crashes when adding new reserved IP #92

Closed v0rap closed 10 months ago

v0rap commented 10 months ago

Describe the bug The vultr.cloud.reserved_ip module throws exception when using it for creating (and possibly removing) reserved IPs. This is due to the self.query_list override in reserved_ip.py:AnsibleVultrReservedIp lacks the query_params kwarg.

To Reproduce Steps to reproduce the behavior:

  1. Create a playbook targeting localhost with the following task defined
    - name: Create reserved IP
    vultr.cloud.reserved_ip:
    label: "my-label"
    region: ams
    ip_type: v4
    instance_id: ""
  2. Export the VULTR_API_KEY environment variable with the value set to your API key
  3. Run the playbook

Expected behavior The reserved IP is created, it moves on to the next task.

Observed behavior It fails with the python error TypeError: AnsibleVultrReservedIp.query_list() got an unexpected keyword argument 'query_params'

Additional context It seems like the reserved_ip module overrides for the query_list method: https://github.com/vultr/ansible-collection-vultr/blob/f64a136e90233a8e1b8a156705d337bb4478a7e2/plugins/modules/reserved_ip.py#L190 which is originally defined in the AnsibleVultr class here: https://github.com/vultr/ansible-collection-vultr/blob/f64a136e90233a8e1b8a156705d337bb4478a7e2/plugins/module_utils/vultr_v2.py#L251

is missing the query_list keyword argument.

Adding either **kwargs or query_list=None to the parameter list for the query_list method fixes the issue, but I'm not sure how these should be used. That's why this is a bug report rather than a pull request.

It seems like this is the only module which contains a redefinition for the AnsibleVultr.query_list method

Let me know if you have any questions or need further clarification! :)

resmo commented 10 months ago

Thanks for reporting, I am investigating

resmo commented 10 months ago

fixed by #93