Dashboard creation succeeds. Or with the above command sequence fails due to something that is not a bug :)
ACTUAL RESULTS
127.0.0.1 - - [26/Jan/2021 15:08:22] "GET /api/frontend/settings HTTP/1.1" 200 -
127.0.0.1 - - [26/Jan/2021 15:08:22] "GET /api/frontend/settings HTTP/1.1" 200 -
127.0.0.1 - - [26/Jan/2021 15:08:22] code 404, message File not found
127.0.0.1 - - [26/Jan/2021 15:08:22] "GET /api/dashboards/db/test HTTP/1.1" 404 -
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: UnboundLocalError: local variable 'folder_exists' referenced before assignment
localhost | FAILED! => {
"changed": false,
"module_stderr": "Traceback (most recent call last):\n File \"/tmp/ansible-tmp-1611666501.8013935-32225-186495449997119/AnsiballZ_grafana_dashboard.py\", line 102, in <module>\n _ansiballz_main()\n File \"/tmp/ansible-tmp-1611666501.8013935-32225-186495449997119/AnsiballZ_grafana_dashboard.py\", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/tmp/ansible-tmp-1611666501.8013935-32225-186495449997119/AnsiballZ_grafana_dashboard.py\", line 40, in invoke_module\n runpy.run_module(mod_name='ansible_collections.community.grafana.plugins.modules.grafana_dashboard', init_globals=None, run_name='__main__', alter_sys=True)\n File \"/nix/store/2wwb85hrvvfzkhrlwcj3pqi60nlbi9cq-python3-3.8.7/lib/python3.8/runpy.py\", line 207, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/nix/store/2wwb85hrvvfzkhrlwcj3pqi60nlbi9cq-python3-3.8.7/lib/python3.8/runpy.py\", line 97, in _run_module_code\n _run_code(code, mod_globals, init_globals,\n File \"/nix/store/2wwb85hrvvfzkhrlwcj3pqi60nlbi9cq-python3-3.8.7/lib/python3.8/runpy.py\", line 87, in _run_code\n exec(code, run_globals)\n File \"/run/user/1000/ansible_community.grafana.grafana_dashboard_payload_71m883ko/ansible_community.grafana.grafana_dashboard_payload.zip/ansible_collections/community/grafana/plugins/modules/grafana_dashboard.py\", line 563, in <module>\n File \"/run/user/1000/ansible_community.grafana.grafana_dashboard_payload_71m883ko/ansible_community.grafana.grafana_dashboard_payload.zip/ansible_collections/community/grafana/plugins/modules/grafana_dashboard.py\", line 525, in main\n File \"/run/user/1000/ansible_community.grafana.grafana_dashboard_payload_71m883ko/ansible_community.grafana.grafana_dashboard_payload.zip/ansible_collections/community/grafana/plugins/modules/grafana_dashboard.py\", line 388, in grafana_create_dashboard\nUnboundLocalError: local variable 'folder_exists' referenced before assignment\n",
"module_stdout": "",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}
Unwrapped module_stderr:
Traceback (most recent call last):
File "/tmp/ansible-tmp-1611666501.8013935-32225-186495449997119/AnsiballZ_grafana_dashboard.py", line 102, in <module>
_ansiballz_main()
File "/tmp/ansible-tmp-1611666501.8013935-32225-186495449997119/AnsiballZ_grafana_dashboard.py", line 94, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/tmp/ansible-tmp-1611666501.8013935-32225-186495449997119/AnsiballZ_grafana_dashboard.py", line 40, in invoke_module
runpy.run_module(mod_name='ansible_collections.community.grafana.plugins.modules.grafana_dashboard', init_globals=None, run_name='__main__', alter_sys=True)
File "/nix/store/2wwb85hrvvfzkhrlwcj3pqi60nlbi9cq-python3-3.8.7/lib/python3.8/runpy.py", line 207, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File "/nix/store/2wwb85hrvvfzkhrlwcj3pqi60nlbi9cq-python3-3.8.7/lib/python3.8/runpy.py", line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/nix/store/2wwb85hrvvfzkhrlwcj3pqi60nlbi9cq-python3-3.8.7/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/run/user/1000/ansible_community.grafana.grafana_dashboard_payload_71m883ko/ansible_community.grafana.grafana_dashboard_payload.zip/ansible_collections/community/grafana/plugins/modules/grafana_dashboard.py", line 563, in <module>
File "/run/user/1000/ansible_community.grafana.grafana_dashboard_payload_71m883ko/ansible_community.grafana.grafana_dashboard_payload.zip/ansible_collections/community/grafana/plugins/modules/grafana_dashboard.py", line 525, in main
File "/run/user/1000/ansible_community.grafana.grafana_dashboard_payload_71m883ko/ansible_community.grafana.grafana_dashboard_payload.zip/ansible_collections/community/grafana/plugins/modules/grafana_dashboard.py", line 388, in grafana_create_dashboard
UnboundLocalError: local variable 'folder_exists' referenced before assignment
SUMMARY
When creating a new dashboard on Grafana 4 the operation fails with:
The
folder_exists
variable only gets assigned when Grafana version is 5 or greater.ISSUE TYPE
COMPONENT NAME
community.grafana.grafana_dashboard
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
NixOS unstable
STEPS TO REPRODUCE
This command sequence should demonstrate the problem.
EXPECTED RESULTS
Dashboard creation succeeds. Or with the above command sequence fails due to something that is not a bug :)
ACTUAL RESULTS
Unwrapped
module_stderr
: