Skip to content
New issue

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

feat(grafana_datasource): add tls_servername argument #395

Merged
merged 2 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelogs/fragments/395-datasource-tls-servername.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
minor_changes:
- Add argument `tls_servername` for `grafana_datasource`
13 changes: 8 additions & 5 deletions plugins/modules/grafana_datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@
requests.
type: bool
default: false
tls_servername:
description:
- A Servername is used to verify the hostname on the returned certificate
type: str
tls_client_cert:
description:
- The client TLS certificate.
Expand Down Expand Up @@ -620,12 +624,10 @@
json_data["tlsAuth"] = True
if data.get("tls_ca_cert"):
secure_json_data["tlsCACert"] = data["tls_ca_cert"]
secure_json_data["tlsClientCert"] = data["tls_client_cert"]
secure_json_data["tlsClientKey"] = data["tls_client_key"]
json_data["tlsAuthWithCACert"] = True
else:
secure_json_data["tlsClientCert"] = data["tls_client_cert"]
secure_json_data["tlsClientKey"] = data["tls_client_key"]
json_data["serverName"] = data["tls_servername"]
secure_json_data["tlsClientCert"] = data["tls_client_cert"]
secure_json_data["tlsClientKey"] = data["tls_client_key"]

Check warning on line 630 in plugins/modules/grafana_datasource.py

View check run for this annotation

Codecov / codecov/patch

plugins/modules/grafana_datasource.py#L628-L630

Added lines #L628 - L630 were not covered by tests
else:
json_data["tlsAuth"] = False
json_data["tlsAuthWithCACert"] = False
Expand Down Expand Up @@ -821,6 +823,7 @@
basic_auth_user=dict(type="str"),
basic_auth_password=dict(type="str", no_log=True),
with_credentials=dict(default=False, type="bool"),
tls_servername=dict(type="str"),
tls_client_cert=dict(type="str", no_log=True),
tls_client_key=dict(type="str", no_log=True),
tls_ca_cert=dict(type="str", no_log=True),
Expand Down
Loading