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

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

Open
stahnjones opened this issue Apr 23, 2024 · 2 comments
Assignees
Labels
1.9.3_triage Bug fixes & Improvements bug Something isn't working

Comments

@stahnjones
Copy link

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 stahnjones added the bug Something isn't working label Apr 23, 2024
@stahnjones
Copy link
Author

trying to follow the documentation but I can not assign myself

@stahnjones
Copy link
Author

Pull 476

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.9.3_triage Bug fixes & Improvements bug Something isn't working
Projects
Development

No branches or pull requests

6 participants