The dictionary loop is not working. But when I specify the parameters not
in a dictionary and not in a loop it works.

On Thu, Sep 14, 2023 at 1:40 PM Tony Wong <[email protected]> wrote:

> The full traceback is:
>   File
> "/var/folders/_f/psbm0b654t9c729qy7r_xl240000gn/T/ansible_cisco.intersight.intersight_rest_api_payload_zqzy7erf/ansible_cisco.intersight.intersight_rest_api_payload.zip/ansible_collections/cisco/intersight/plugins/module_utils/intersight.py",
> line 243, in call_api
>     raise RuntimeError(info['status'], info['msg'], info['body'])
> failed: [localhost] (item={'name_of_uuid_pool': 'UUID Pool 1',
> 'uuid_prefix': '00000000-0000-0000', 'uuid_size': 100, 'uuid_from':
> '0000-000000000001'}) => {
>     "ansible_loop_var": "item",
>     "changed": false,
>     "invocation": {
>         "module_args": {
>             "api_body": {
>                 "AssignmentOrder": "default",
>                 "Description": "UUID Pool 1",
>                 "Name": "UUID Pool 1",
>                 "Organization": {
>                     "Moid": "64fb3cc06972653301785b28"
>                 },
>                 "Prefix": "00000000-0000-0000",
>                 "Tags": [
>                     {
>                         "Key": "configmode",
>                         "Value": "ansible"
>                     },
>                     {
>                         "Key": "prefix",
>                         "Value": "PKXXXPK"
>                     }
>                 ],
>                 "UuidSuffixBlocks": [
>                     {
>                         "From": "0000-000000000001",
>                         "Size": "100"
>                     }
>                 ]
>             },
>             "api_key_id":
> "64fb3cbd7564613301d27632/64fb3cbe7564613301d27636/64fe94c77564613301f091c2",
>             "api_private_key": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
>             "api_uri": "https://intersight.com/api/v1";,
>             "list_body": null,
>             "query_params": {
>                 "$filter": "Name eq 'UUID Pool 1'"
>             },
>             "resource_path": "/uuidpool/Pools",
>             "return_list": false,
>             "state": "present",
>             "update_method": "patch",
>             "use_proxy": true,
>             "validate_certs": true
>         }
>     },
>     "item": {
>         "name_of_uuid_pool": "UUID Pool 1",
>         "uuid_from": "0000-000000000001",
>         "uuid_prefix": "00000000-0000-0000",
>         "uuid_size": 100
>     },
>     "msg": "API error: (400, 'HTTP Error 400: Bad Request',
> b'{\"code\":\"InvalidRequest\",\"message\":\"Cannot execute the request.
> The JSON document is
> malformed.\",\"messageId\":\"barcelona_request_malformed_json\",\"traceId\":\"2wMlVD0eKFBFiksN2fyS47UyPFHNB4WiXSwqP_pg8FP7QZ-s81Tb1A==\",\"cause\":{\"code\":\"InternalServerError\",\"message\":\"Cannot
> execute the request due to an error. Retry
> later.\",\"messageId\":\"barcelona_request_internal_error\",\"traceId\":\"2wMlVD0eKFBFiksN2fyS47UyPFHNB4WiXSwqP_pg8FP7QZ-s81Tb1A==\"}}')
> "
> }
>
> On Thu, Sep 14, 2023 at 12:49 PM Dick Visser <[email protected]> wrote:
>
>> It says malformed json, so that's pretty obvious.
>> Try running with -v to (hopefully) see what's being posted as json and
>> there should be your solution.
>>
>>
>> Sent from Gmail Mobile
>>
>>
>> On Thu, 14 Sep 2023 at 19:09, Tony Wong <[email protected]> wrote:
>>
>>> any idea why I keep getting this error with this pb?
>>>
>>> ---
>>> - name: "Create UUID Pool"
>>> vars:
>>> api_info: &api_info
>>> api_private_key: "{{ api_private_key }}"
>>> api_key_id: "{{ api_key_id }}"
>>> api_uri: "{{ api_uri | default(omit) }}"
>>> validate_certs: "{{ validate_certs | default(omit) }}"
>>> state: "{{ state | default(omit) }}"
>>>
>>> cisco.intersight.intersight_rest_api:
>>> <<: *api_info
>>> resource_path: /uuidpool/Pools
>>> query_params:
>>> $filter: "Name eq '{{ item.name_of_uuid_pool }}'"
>>> api_body: {
>>> "Name": "{{ item.name_of_uuid_pool }}",
>>> "Description": "{{ item.name_of_uuid_pool }}",
>>> "Organization": {
>>> "Moid": "{{ intersight_org.api_response.Moid }}"
>>> },
>>> Tags: [{Key: "configmode", Value: "ansible"}, {Key: "prefix", Value: "{{
>>> prefix }}"}],
>>>
>>> "AssignmentOrder": "default",
>>> "Prefix": "{{ item.uuid_prefix }}",
>>> "UuidSuffixBlocks": [
>>> {
>>> "From": "{{ item.uuid_from }}",
>>> "Size": "{{ item.uuid_size }}"
>>> }
>>> ]
>>> }
>>> loop: "{{ uuid_pools }}"
>>> register: uuid_pool_result
>>>
>>> TASK [create_pools : Create UUID Pool]
>>> **************************************************************
>>> failed: [localhost] (item={'name_of_uuid_pool': 'UUID Pool 1',
>>> 'uuid_prefix': '00000000-0000-0000', 'uuid_size': 100, 'uuid_from':
>>> '0000-000000000001'}) => {"ansible_loop_var": "item", "changed": false,
>>> "item": {"name_of_uuid_pool": "UUID Pool 1", "uuid_from":
>>> "0000-000000000001", "uuid_prefix": "00000000-0000-0000", "uuid_size":
>>> 100}, "msg": "API error: (400, 'HTTP Error 400: Bad Request',
>>> b'{\"code\":\"InvalidRequest\",\"message\":\"Cannot execute the request.
>>> The JSON document is
>>> malformed.\",\"messageId\":\"barcelona_request_malformed_json\",\"traceId\":\"MITgFj7I9LY9WhE3CmsPWPyfXM6nIqWYFeeBrGUXx5cHPLBhZNY8sg==\",\"cause\":{\"code\":\"InternalServerError\",\"message\":\"Cannot
>>> execute the request due to an error. Retry
>>> later.\",\"messageId\":\"barcelona_request_internal_error\",\"traceId\":\"MITgFj7I9LY9WhE3CmsPWPyfXM6nIqWYFeeBrGUXx5cHPLBhZNY8sg==\"}}')
>>> "}
>>> failed: [localhost] (item={'name_of_uuid_pool': 'UUID Pool 2',
>>> 'uuid_prefix': '11111111-1111-1111', 'uuid_size': 50, 'uuid_from':
>>> '1111-111111111101'}) => {"ansible_loop_var": "item", "changed": false,
>>> "item": {"name_of_uuid_pool": "UUID Pool 2", "uuid_from":
>>> "1111-111111111101", "uuid_prefix": "11111111-1111-1111", "uuid_size": 50},
>>> "msg": "API error: (400, 'HTTP Error 400: Bad Request',
>>> b'{\"code\":\"InvalidRequest\",\"message\":\"Cannot execute the request.
>>> The JSON document is
>>> malformed.\",\"messageId\":\"barcelona_request_malformed_json\",\"traceId\":\"uCoQYEn3PXD6v9QT6d8Nz3KDNGP_7KrDsa3Gnz75YuuXecj5ALedPw==\",\"cause\":{\"code\":\"InternalServerError\",\"message\":\"Cannot
>>> execute the request due to an error. Retry
>>> later.\",\"messageId\":\"barcelona_request_internal_error\",\"traceId\":\"uCoQYEn3PXD6v9QT6d8Nz3KDNGP_7KrDsa3Gnz75YuuXecj5ALedPw==\"}}')
>>> "}
>>>
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Ansible Project" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-project/9773485e-c61c-481a-8f32-03240f8b045an%40googlegroups.com
>>> <https://groups.google.com/d/msgid/ansible-project/9773485e-c61c-481a-8f32-03240f8b045an%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Ansible Project" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/ansible-project/2IhA8gwVLuM/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/CAF8BbLabg-JUcVAnJH93qGnGSga%2BXwFx3OvfVE_1zb_msfPOOw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/ansible-project/CAF8BbLabg-JUcVAnJH93qGnGSga%2BXwFx3OvfVE_1zb_msfPOOw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CALmkhkopCpH61tWak1ekCaUqNpCxOd-dYCD9rhLz9MtwVDrcqg%40mail.gmail.com.

Reply via email to