nutanix / nutanix.ansible

Official Nutanix Ansible collections
GNU General Public License v3.0
61 stars 34 forks source link

[Bug] Fix comparison of old_context_list and update_context_list in module ntnx_acps #475

Open stahnjones opened 2 months ago

stahnjones commented 2 months ago

Describe the bug As exists, items can only be removed from a filters list (context_list item in API) , but no new items can be added.

To Reproduce Steps to reproduce the behavior:

  1. ansible-playbook test_nutanix_acp.yml
  2. sample playbook: `- hosts: localhost gather_facts: false vars: role: uuid: "00000000-0000-0000-0000-123456789012" name: test role project: uuid: "12345678-1234-2345-3456-789012345678"

    tasks:

    • name: create basic ACP nutanix.ncp.ntnx_acps: validate_certs: False state: present nutanix_host: "{{ IP }}" nutanix_username: "{{ username }}" nutanix_password: "{{ password }}" wait: true name: MinACP role: uuid: '{{ role.uuid }}' register: basic_acp

    • name: Update new basic ACP with a scope-entity filter object nutanix.ncp.ntnx_acps: validate_certs: False state: present nutanix_host: "{{ IP }}" nutanix_username: "{{ username }}" nutanix_password: "{{ password }}" wait: true name: "MinACP-modified" role: uuid: '{{ role.uuid }}' acp_uuid: "{{ basic_acp.response.metadata.uuid }}" filters:

      • scope_filter:
        • lhs: PROJECT operator: IN rhs: uuid_list:
          • "{{ project.uuid }}" entity_filter:
      • lhs: ALL operator: IN rhs: collection: ALL register: update_acp
    • debug: var: update_acp

    `

Stack trace N/A

Expected behavior update an existing ACP's filters list

Additional context Comparison is only going one way - checking if items in the existing filter list are in the updated filter list. To add a new entry to the filters object, the comparison needs to go the other way - check if the items in the updated filter list are in the existing filter list.

stahnjones commented 2 months ago

trying to follow the documentation but I can not assign myself

stahnjones commented 1 month ago

Pull 476