From f268291a009c6211eeda4f3441ac4b4a3a889676 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Mar 2025 14:01:00 -0400 Subject: [PATCH 1/5] Bump uri from 1.0.2 to 1.0.3 (#846) Bumps [uri](https://github.com/ruby/uri) from 1.0.2 to 1.0.3. - [Release notes](https://github.com/ruby/uri/releases) - [Commits](https://github.com/ruby/uri/compare/v1.0.2...v1.0.3) --- updated-dependencies: - dependency-name: uri dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 7ea5c941..8ecffe46 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -461,7 +461,7 @@ GEM tty-cursor (~> 0.7) unicode-display_width (2.6.0) unicode_utils (1.4.0) - uri (1.0.2) + uri (1.0.3) voxpupuli-puppet-lint-plugins (5.0.0) puppet-lint (~> 4.0) puppet-lint-absolute_classname-check (~> 4.0) @@ -508,6 +508,7 @@ PLATFORMS arm64-darwin-22 arm64-darwin-24 x64-mingw32 + x86_64-linux DEPENDENCIES CFPropertyList (< 3.0.7) From 56a50aa1df4a1294da0ffdc076d55deda1b7d879 Mon Sep 17 00:00:00 2001 From: Fanny Jiang Date: Mon, 24 Mar 2025 06:30:17 -0400 Subject: [PATCH 2/5] Fix Datadog Reports (#848) * test * fix datadog_reports * fix rocky kitchen tests * fix rocky kitchen tests * kitchen --- kitchen.yml | 3 ++- lib/puppet/reports/datadog_reports.rb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/kitchen.yml b/kitchen.yml index 998d744f..9e6b2301 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -112,10 +112,11 @@ platforms: - dnf module -y reset ruby - dnf module -y enable ruby:3.1 - dnf module -y install ruby:3.1/common + - dnf update -y - rpm -Uvh https://yum.puppet.com/puppet8-release-el-9.noarch.rpm #installs the puppet-agent repo - yum install -y puppet-agent-8.10.0 rubygems ruby-devel procps-ng - - dnf group install -y "Development Tools" + - dnf group install -y "Development Tools" --nobest - ln -s /opt/puppetlabs/bin/puppet /usr/bin/puppet - mkdir /home/kitchen/puppet -p diff --git a/lib/puppet/reports/datadog_reports.rb b/lib/puppet/reports/datadog_reports.rb index 86ffde7f..7ed2a38d 100644 --- a/lib/puppet/reports/datadog_reports.rb +++ b/lib/puppet/reports/datadog_reports.rb @@ -127,7 +127,7 @@ def process Puppet.debug "Sending metrics for #{@msg_host} to Datadog" @dog.batch_metrics do metrics.each do |metric, data| - data.each_value do |val| + data.values.each do |val| # rubocop:disable Style/HashEachMethods name = "puppet.#{val[1].tr(' ', '_')}.#{metric}".downcase value = val[2] @dog.emit_point(name.to_s, value, host: @msg_host.to_s) From d2da2f81e8cd0a59595118d87d199c90d75f49fe Mon Sep 17 00:00:00 2001 From: Fanny Jiang Date: Mon, 24 Mar 2025 06:31:07 -0400 Subject: [PATCH 3/5] Fix tcp_check for multi instances (#851) * fix tcp_check for multi instances * add test --- manifests/integrations/tcp_check.pp | 6 +-- ...tadog_agent_integrations_tcp_check_spec.rb | 39 +++++++++++++++++++ 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/manifests/integrations/tcp_check.pp b/manifests/integrations/tcp_check.pp index 78d2710b..6f2087a4 100644 --- a/manifests/integrations/tcp_check.pp +++ b/manifests/integrations/tcp_check.pp @@ -81,9 +81,9 @@ # }] # } class datadog_agent::integrations::tcp_check ( - String $check_name, - String $host, - String $port, + Optional[String] $check_name = undef, + Optional[String] $host = undef, + Optional[String] $port = undef, Integer $timeout = 10, Optional[Integer] $threshold = undef, Optional[Integer] $window = undef, diff --git a/spec/classes/datadog_agent_integrations_tcp_check_spec.rb b/spec/classes/datadog_agent_integrations_tcp_check_spec.rb index d1783867..55f3dd0e 100644 --- a/spec/classes/datadog_agent_integrations_tcp_check_spec.rb +++ b/spec/classes/datadog_agent_integrations_tcp_check_spec.rb @@ -112,6 +112,45 @@ skip('doubly undefined behavior') end + + context 'with multiple instances' do + let(:params) do + { + instances: [ + { + check_name: 'foo.bar.baz', + host: 'foo.bar.baz', + port: '80', + timeout: 123, + threshold: 456, + window: 789, + collect_response_time: true, + }, + { + check_name: 'baz.bar.foo', + host: 'baz.bar.foo', + port: '8080', + timeout: 456, + tags: ['foo', 'bar', 'baz'] + }, + ] + } + end + + it { is_expected.to contain_file(conf_file).with_content(%r{name: foo.bar.baz}) } + it { is_expected.to contain_file(conf_file).with_content(%r{host: foo.bar.baz}) } + it { is_expected.to contain_file(conf_file).with_content(%r{port: 80}) } + it { is_expected.to contain_file(conf_file).with_content(%r{timeout: 123}) } + it { is_expected.to contain_file(conf_file).with_content(%r{threshold: 456}) } + it { is_expected.to contain_file(conf_file).with_content(%r{window: 789}) } + it { is_expected.to contain_file(conf_file).with_content(%r{collect_response_time: true}) } + + it { is_expected.to contain_file(conf_file).with_content(%r{name: baz.bar.foo}) } + it { is_expected.to contain_file(conf_file).with_content(%r{host: baz.bar.foo}) } + it { is_expected.to contain_file(conf_file).with_content(%r{port: 8080}) } + it { is_expected.to contain_file(conf_file).with_content(%r{timeout: 456}) } + it { is_expected.to contain_file(conf_file).with_content(%r{tags:\s+- foo\s+- bar\s+- baz\s*?[^-]}m) } + end end end end From 56840839d3b677df8836dcb6f4f3b430777f0c25 Mon Sep 17 00:00:00 2001 From: Niels Date: Thu, 3 Apr 2025 21:34:13 +0200 Subject: [PATCH 4/5] fix: do not set empty tls_protocols_allowed and tls_ciphers for es (#852) * fix: do not set empty tls_protocol_allowed and tls_ciphers for es * fix: do not fail when tls_protocols_allowed and tls_ciphers are not passed via _instances Fix: Added fallback for possible empty params * fix: remove whitespace --- templates/agent-conf.d/elastic.yaml.erb | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/templates/agent-conf.d/elastic.yaml.erb b/templates/agent-conf.d/elastic.yaml.erb index a461ad3a..826ac644 100644 --- a/templates/agent-conf.d/elastic.yaml.erb +++ b/templates/agent-conf.d/elastic.yaml.erb @@ -33,22 +33,25 @@ instances: <%- if instance['tls_ignore_warning'] && instance['tls_ignore_warning'] != :undef -%> tls_ignore_warning: <%= instance['tls_ignore_warning'] %> <%- end -%> -<%- unless instance['tags'].empty? -%> +<%- tags = Array(instance['tags']) -%> +<%- unless tags.empty? -%> tags: - <%- instance['tags'].each do |tag| -%> + <%- tags.each do |tag| -%> - <%= tag %> - <%- end -%> + <%- end -%> <%- end -%> -<%- unless instance['tls_protocols_allowed'].nil? -%> +<%- protocols = Array(instance['tls_protocols_allowed']) -%> + <%- unless protocols.empty? -%> tls_protocols_allowed: - <%- instance['tls_protocols_allowed'].each do |protocol| -%> + <%- protocols.each do |protocol| -%> - <%= protocol %> + <%- end -%> <%- end -%> -<%- end -%> -<%- unless instance['tls_ciphers'].nil? -%> + <%- ciphers = Array(instance['tls_ciphers']) -%> + <%- unless ciphers.empty? -%> tls_ciphers: - <%- instance['tls_ciphers'].each do |cipher| -%> + <%- ciphers.each do |cipher| -%> - <%= cipher %> + <%- end -%> <%- end -%> <%- end -%> -<%- end -%> From 34e639c7a5e27b774583c6220ff90bab671b757a Mon Sep 17 00:00:00 2001 From: Fanny Jiang Date: Thu, 3 Apr 2025 16:15:25 -0400 Subject: [PATCH 5/5] Update changelog for datadog puppet module v4.0.1 (#855) * Update changelog for datadog puppet module v4.0.1 * Update metadata.json version to 4.0.1 * fix version in changelog --- CHANGELOG.md | 11 +++++++++++ metadata.json | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ffb69ebe..48248bd3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ Changes +# 4.0.1 / 2025-04-03 + +* [BUGFIX] Bump uri from 1.0.2 to 1.0.3 ([#846]). +* [BUGFIX] Fix Datadog Reports ([#848]). +* [BUGFIX] Fix tcp_check for multi-instances ([#851]). +* [BUGFIX] Fix do not set empty tls_protocols_allowed and tls_ciphers for elasticsearch ([#852])(thanks [@nielstholenaar]). + # 4.0.0 / 2025-03-10 This release has multiple breaking changes. You may need to update your module integration. Note that module @@ -978,6 +985,10 @@ Please read the [docs]() for more details. [#824]: https://github.com/DataDog/puppet-datadog-agent/issues/824 [#835]: https://github.com/DataDog/puppet-datadog-agent/issues/835 [#838]: https://github.com/DataDog/puppet-datadog-agent/issues/838 +[#846]: https://github.com/DataDog/puppet-datadog-agent/issues/846 +[#848]: https://github.com/DataDog/puppet-datadog-agent/issues/848 +[#851]: https://github.com/DataDog/puppet-datadog-agent/issues/851 +[#852]: https://github.com/DataDog/puppet-datadog-agent/issues/852 [@Aramack]: https://github.com/Aramack [@BIAndrews]: https://github.com/BIAndrews [@ChannoneArif-nbcuni]: https://github.com/ChannoneArif-nbcuni diff --git a/metadata.json b/metadata.json index 10b7e5f9..eaf35455 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "datadog-datadog_agent", - "version": "4.0.0", + "version": "4.0.1", "author": "James Turnbull , Rob Terhaar , Jaime Fullaondo , Albert Vaca ", "summary": "Install the Datadog monitoring agent and report Puppet runs to Datadog", "license": "Apache-2.0",