We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Using lookup plugin "grafana_dashboard" with a service account token returns 401 (Unauthorized)
https://github.com/ansible-collections/community.grafana/blob/main/plugins/lookup/grafana_dashboard.py#L118 appends '==' to all service account tokens generated with Grafana 9.2.x which makes the resulting Authorization Header invalid.
Please verify whether that logic is still applicable.
plugins/lookup/grafana_dashboard.py
ansible-playbook [core 2.14.3]
community.grafana 1.5.4
Grafana 9.2.10
tasks: - name: get existing dashboards set_fact: grafana_dashboards: "{{ lookup('grafana_dashboard', 'grafana_url=' ~ grafana_server_url ~ ' grafana_api_key=' ~ grafana_api_key) }}" - debug: var: grafana_dashboards
List of defined dashboards is returned.
The expected result can be enforce by removing 118-124 from https://github.com/ansible-collections/community.grafana/blob/main/plugins/lookup/grafana_dashboard.py#L118
fatal: [ansible_master]: FAILED! => {"msg": "An unhandled exception occurred while running the lookup plugin 'grafana_dashboard'. Error was a <class 'ansible_collections.community.grafana.plugins.lookup.grafana_dashboard.GrafanaAPIException'>, original message: Unable to search dashboards : HTTP Error 401: Unauthorized. Unable to search dashboards : HTTP Error 401: Unauthorized"}
The text was updated successfully, but these errors were encountered:
Hi @fotto, are you still having this problem? Please let me know. 401 sounds like an authentication problem or a wrong token.
Sorry, something went wrong.
Unfortunately, I cannot easily reproduce the setup.
Nemental
Successfully merging a pull request may close this issue.
SUMMARY
Using lookup plugin "grafana_dashboard" with a service account token returns 401 (Unauthorized)
https://github.com/ansible-collections/community.grafana/blob/main/plugins/lookup/grafana_dashboard.py#L118 appends '==' to all service account tokens generated with Grafana 9.2.x which makes the resulting Authorization Header invalid.
Please verify whether that logic is still applicable.
ISSUE TYPE
COMPONENT NAME
plugins/lookup/grafana_dashboard.py
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
Grafana 9.2.10
STEPS TO REPRODUCE
EXPECTED RESULTS
List of defined dashboards is returned.
The expected result can be enforce by removing 118-124 from https://github.com/ansible-collections/community.grafana/blob/main/plugins/lookup/grafana_dashboard.py#L118
ACTUAL RESULTS
The text was updated successfully, but these errors were encountered: