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 CI again #909

Merged
merged 10 commits into from
Feb 16, 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
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ source 'https://rubygems.org'
chef_version = ENV.fetch('CHEF_VERSION', '14.10.9')

gem 'rake'
gem 'rspec-expectations', '< 3.12.4'
gem 'chef', "= #{chef_version}"
gem 'cucumber-core', '~> 3.2.1'
gem 'yaml'
Expand All @@ -19,6 +20,10 @@ gem 'rbnacl', '~> 4.0.2'
gem 'rbnacl-libsodium', '~> 1.0.16'
gem 'bcrypt_pbkdf', '>= 1.0', '< 2.0'

if RUBY_VERSION >= '3.0.0' && RUBY_VERSION < '3.1.0'
gem 'uri', '= 0.10.1'
end

if RUBY_VERSION < '2.4'
gem 'json', '~> 2.4.1'
end
Expand Down
4 changes: 4 additions & 0 deletions kitchen.docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ platforms:
require_chef_omnibus: 16.17.4
image: 'datadog/docker-library:chef_kitchen_systemd_rocky_8'
run_command: /root/start.sh
# workaround https://github.com/chef/chef/issues/14034 which has been
# fixed, but only for fresh Chef versions (>= 18)
provision_command:
- echo "CentOS Linux release 8" > /etc/redhat-release

suites:
<%
Expand Down
7 changes: 6 additions & 1 deletion recipes/dd-agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,20 @@ def template_vars
system_probe_managed = node['datadog']['system_probe']['manage_config']
agent_version_greater_than_6_11 = agent_major_version > 5 && (agent_minor_version.nil? || agent_minor_version > 11) || agent_major_version > 6
agent_version_greater_than_6_26 = agent_major_version > 5 && (agent_minor_version.nil? || agent_minor_version > 26)
agent_version_greater_than_6_49 = agent_major_version > 5 && (agent_minor_version.nil? || agent_minor_version > 49)

# System probe requires at least agent 6.12 on Linux or 6.27 on Windows, before that it was called the network-tracer or unsupported.
system_probe_supported = (agent_version_greater_than_6_11 && !is_windows) || (agent_version_greater_than_6_26 && is_windows)

# system-probe is a dependency of the agent on Linux or Windows
include_recipe '::system-probe' if system_probe_managed && system_probe_supported

# Security Agent requires at least agent 6.27 on Linux or 6.50 on Windows, before that it was unsupported.
security_agent_managed = node['datadog']['security_agent']['cws']['enabled'] || (!is_windows && node['datadog']['security_agent']['cspm']['enabled'])
security_agent_supported = (agent_version_greater_than_6_26 && !is_windows) || (agent_version_greater_than_6_49 && is_windows)

# security-agent is a dependency of the agent on Linux or Windows
include_recipe '::security-agent'
include_recipe '::security-agent' if security_agent_managed && security_agent_supported

# Installation metadata to let know the agent about installation method and its version
include_recipe '::install_info'
Expand Down
11 changes: 3 additions & 8 deletions recipes/security-agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
is_windows = platform_family?('windows')

# Set the correct agent startup action
security_agent_enabled = node['datadog']['security_agent']['cws']['enabled'] || (!is_windows && node['datadog']['security_agent']['cspm']['enabled'])
security_agent_start = security_agent_enabled && node['datadog']['agent_start'] && node['datadog']['agent_enable'] ? :start : :stop
security_agent_start = node['datadog']['agent_start'] && node['datadog']['agent_enable'] ? :start : :stop

#
# Configures security-agent agent
Expand All @@ -31,7 +30,6 @@
else
'/etc/datadog-agent/security-agent.yaml'
end
security_agent_config_file_exists = ::File.exist?(security_agent_config_file)

template security_agent_config_file do
runtime_security_extra_config = {}
Expand Down Expand Up @@ -64,10 +62,7 @@
mode '640'
end

notifies :restart, 'service[datadog-agent-security]', :delayed if security_agent_enabled

# Security agent is not enabled and the file doesn't exists, don't create it
not_if { !security_agent_enabled && !security_agent_config_file_exists }
notifies :restart, 'service[datadog-agent-security]', :delayed
end

# Common configuration
Expand All @@ -86,5 +81,5 @@
else
supports :restart => true, :status => true, :start => true, :stop => true
end
subscribes :restart, "template[#{security_agent_config_file}]", :delayed if security_agent_enabled
subscribes :restart, "template[#{security_agent_config_file}]", :delayed
end
Loading