CiscoDevNet / FMCAnsible

GNU General Public License v3.0
21 stars 25 forks source link

Documentation update for create multiple #62

Open lavermil opened 9 months ago

lavermil commented 9 months ago

Hello,

When trying the example in the link below I end up with an error saying duplicate dict key.

[WARNING]: While constructing a mapping from /home/testuser/ansible/createnetobjects.yml, line 15, column 11, found a duplicate dict key (name). Using last defined value only.
[WARNING]: While constructing a mapping from /home/testuser/ansible/createnetobjects.yml, line 15, column 11, found a duplicate dict key (value). Using last defined value only.
[WARNING]: While constructing a mapping from /home/testuser/ansible/createnetobjects.yml, line 15, column 11, found a duplicate dict key (description). Using last defined value only.
[WARNING]: While constructing a mapping from /home/testuser/ansible/createnetobjects.yml, line 15, column 11, found a duplicate dict key (type). Using last defined value only.
- name: Execute 'createMultipleNetworkObject' operation
  cisco.fmcansible.fmc_configuration:
    operation: "createMultipleNetworkObject"
    data:
        name: "net1"
        value: "1.0.0.0/24"
        overridable: False
        description: "Network obj 1"
        type: "NetworkObject"
        name: "net2"
        value: "1.1.0.0/24"
        overridable: False
        description: "Network obj 2"
        type: "NetworkObject"
    path_params:
        domainUUID: "{{ domain_uuid }}"
    query_params:
        bulk: "{{ bulk }}"

https://github.com/CiscoDevNet/FMCAnsible/blob/main/samples/docs/operations/create_multiple_network_object.md

After some testing the problem is in fact the format for which the example shows does have duplicate keys. If you modify the the example as below everything works correctly.

A corrected version of the example

- name: Execute 'createMultipleNetworkObject' operation
  cisco.fmcansible.fmc_configuration:
    operation: "createMultipleNetworkObject"
    data:
        - name: "net1"
          value: "1.0.0.0/24"
          overridable: False
          description: "Network obj 1"
          type: "NetworkObject"
        - name: "net2"
          value: "1.1.0.0/24"
          overridable: False
          description: "Network obj 2"
          type: "NetworkObject"
    path_params:
        domainUUID: "{{ domain_uuid }}"
    query_params:
        bulk: "{{ bulk }}"