-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Hi Jan,
how can I access array elements?
- type: "set"
path: "colors[1].color"
value: "orange"
Create an element of name "colors[1]"
- type: "set"
path: "colors.[1].color"
value: "orange"
generate the following error:
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: list indices must be integers, not str
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/tmp/ansible_thYFWT/ansible_module_json_module.py\", line 183, in <module>\n main()\n File \"/tmp/ansible_thYFWT/ansible_module_json_module.py\", line 169, in main\n if CHANGES_MAP.get(change['type'])(json_data, change):\n File \"/tmp/ansible_thYFWT/ansible_module_json_module.py\", line 101, in set_action\n result = query(json_data, change['path'])\n File \"/tmp/ansible_thYFWT/ansible_module_json_module.py\", line 82, in query\n ref[part] = {}\nTypeError: list indices must be integers, not str\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 1}
Metadata
Metadata
Assignees
Labels
No labels