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

fix: do not set empty tls_protocols_allowed and tls_ciphers for es #852

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nielstholenaar
Copy link
Contributor

What does this PR do?

This PR resolves an issue with the Elasticsearch integration, that prevented the integration from working when there are no values passed for tls_protocols_allowed or tls_ciphers.

Motivation

When not passing any values for the tls_protocols_allowed or tls_ciphers the following config is being generated:

--- /etc/datadog-agent/conf.d/elastic.d/conf.yaml
+++ /tmp/puppet-file20250314-2365624-ndvht2
@@ -8,3 +8,5 @@
       index_stats: true
       pshard_stats: false
       pending_task_stats: true
+      tls_protocols_allowed:
+      tls_ciphers:

This result in the error below:

2025-03-14 14:26:58 CET | CORE | ERROR | (pkg/collector/worker/check_logger.go:71 in Error) | check:elastic | Error running check: [{"message":"'NoneType' object is not iterable","traceback":"Traceback (most recent call last):\n  File \"/opt/datadog-agent/embedded/lib/python3.12/site-packages/datadog_checks/base/checks/base.py\", line 1301, in run\n    self.check(instance)\n  File \"/opt/datadog-agent/embedded/lib/python3.12/site-packages/datadog_checks/elastic/elastic.py\", line 141, in check\n    stats_data = self._get_data(stats_url)\n                 ^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/opt/datadog-agent/embedded/lib/python3.12/site-packages/datadog_checks/elastic/elastic.py\", line 336, in _get_data\n    resp = self.http.get(url)\n           ^^^^^^^^^\n  File \"/opt/datadog-agent/embedded/lib/python3.12/site-packages/datadog_checks/base/checks/base.py\", line 400, in http\n    self._http = RequestsWrapper(self.instance or {}, self.init_config, self.HTTP_CONFIG_REMAPPER, self.log)\n                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/opt/datadog-agent/embedded/lib/python3.12/site-packages/datadog_checks/base/utils/http.py\", line 324, in __init__\n    for protocol in config['tls_protocols_allowed']:\n                    ~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^\nTypeError: 'NoneType' object is not iterable\n"}]

Additional Notes

Describe your test plan

@nielstholenaar nielstholenaar requested review from a team as code owners March 14, 2025 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant