Add support for AlmaLinux and Rocky Linux
MODIFY
.circleci/config.yml
.circleci/config.yml
@@ -3,6 +3,7 @@ jobs:
kitchen-docker-tests:
machine: true
environment:
+ CHEF_LICENSE: accept # newer versions of Chef client need explicit license accept to run
KITCHEN_LOCAL_YAML: kitchen.docker.yml
RUBY_VERSION: '2.6.3' # ruby used to invoke kitchen, not the version used in the tests
steps:

MODIFY
README.md
README.md
@@ -19,10 +19,12 @@ The Datadog Chef cookbook is compatible with `chef-client` >= 12.7. If you need
The following platforms are supported:
+* AlmaLinux (requires Chef 16 >= 16.10.8 or Chef >= 17.0.69)
* Amazon Linux
* CentOS
* Debian
* RedHat (RHEL 8 requires Chef >= 15)
+* Rocky (requires Chef 16 >= 16.17.4 or Chef >= 17.1.35)
* Scientific Linux
* Ubuntu
* Windows

MODIFY
kitchen.docker.yml
kitchen.docker.yml
@@ -39,6 +39,12 @@ platforms:
- name: debian-8.11
driver_config:
require_chef_omnibus: 14.12
+ - name: rocky-8
+ driver_config:
+ platform: rhel # kitchen-docker doesn't recognize rocky otherwise
+ require_chef_omnibus: 16.17.4
+ image: 'datadog/docker-library:chef_kitchen_systemd_rocky_8'
+ run_command: /root/start.sh
suites:
<%

MODIFY
kitchen.yml
kitchen.yml
@@ -15,6 +15,7 @@ platforms:
centos-6.6
centos-7.1
debian-7.8
+ rockylinux-8.5
)
chef_versions = %w(
12.7.2

MODIFY
spec/dd-agent_spec.rb
spec/dd-agent_spec.rb
@@ -134,6 +134,36 @@ describe 'datadog::dd-agent' do
it_behaves_like 'rhellions dnf no version set'
end
+ context 'on AlmaLinux distro', if: min_chef_version('17.0.69') do
+ cached(:chef_run) do
+ ChefSpec::SoloRunner.new(
+ :platform => 'almalinux',
+ :version => '8'
+ ) do |node|
+ node.normal['datadog'] = { 'api_key' => 'somethingnotnil' }
+ node.normal['languages'] = { 'python' => { 'version' => '2.7.9' } }
+ end.converge described_recipe
+ end
+
+ it_behaves_like 'repo recipe'
+ it_behaves_like 'rhellions dnf no version set'
+ end
+
+ context 'on Rocky Linux distro', if: min_chef_version('17.1.35') do
+ cached(:chef_run) do
+ ChefSpec::SoloRunner.new(
+ :platform => 'rocky',
+ :version => '8'
+ ) do |node|
+ node.normal['datadog'] = { 'api_key' => 'somethingnotnil' }
+ node.normal['languages'] = { 'python' => { 'version' => '2.7.9' } }
+ end.converge described_recipe
+ end
+
+ it_behaves_like 'repo recipe'
+ it_behaves_like 'rhellions dnf no version set'
+ end
+
context 'on Windows' do
cached(:chef_run) do
set_env_var('ProgramData', 'C:\ProgramData')

MODIFY
spec/repository_spec.rb
spec/repository_spec.rb
@@ -391,6 +391,50 @@ describe 'datadog::repository' do
).with(repo_gpgcheck: true)
end
end
+
+ context 'almalinux 8.5, agent 6', if: min_chef_version('17.0.69') do
+ cached(:chef_run) do
+ ChefSpec::SoloRunner.new(
+ platform: 'almalinux', version: '8'
+ ) do |node|
+ node.normal['datadog'] = { 'agent_major_version' => '6' }
+ node.automatic['platform_version'] = '8.5'
+ end.converge(described_recipe)
+ end
+
+ it 'sets up the yum repo' do
+ expect(chef_run).to create_yum_repository('datadog').with(
+ gpgkey: [
+ 'https://keys.datadoghq.com/DATADOG_RPM_KEY_CURRENT.public',
+ 'https://keys.datadoghq.com/DATADOG_RPM_KEY_E09422B3.public',
+ 'https://keys.datadoghq.com/DATADOG_RPM_KEY_FD4BF915.public',
+ 'https://keys.datadoghq.com/DATADOG_RPM_KEY.public',
+ ]
+ ).with(repo_gpgcheck: true)
+ end
+ end
+
+ context 'rocky 8.5, agent 6', if: min_chef_version('17.1.35') do
+ cached(:chef_run) do
+ ChefSpec::SoloRunner.new(
+ platform: 'rocky', version: '8'
+ ) do |node|
+ node.normal['datadog'] = { 'agent_major_version' => '6' }
+ node.automatic['platform_version'] = '8.5'
+ end.converge(described_recipe)
+ end
+
+ it 'sets up the yum repo' do
+ expect(chef_run).to create_yum_repository('datadog').with(
+ gpgkey: [
+ 'https://keys.datadoghq.com/DATADOG_RPM_KEY_CURRENT.public',
+ 'https://keys.datadoghq.com/DATADOG_RPM_KEY_E09422B3.public',
+ 'https://keys.datadoghq.com/DATADOG_RPM_KEY_FD4BF915.public',
+ 'https://keys.datadoghq.com/DATADOG_RPM_KEY.public',
+ ]
+ ).with(repo_gpgcheck: true)
+ end
+ end
end
context 'suseiods' do

MODIFY
spec/spec_helper.rb
spec/spec_helper.rb
@@ -8,6 +8,10 @@ require 'yaml'
require 'shared_examples'
+def min_chef_version(version)
+ Gem.loaded_specs['chef'].version > Gem::Version.new(version)
+end
+
RSpec.configure do |config|
# Use color not only in STDOUT but also in pagers and files
config.tty = true

Add support for AlmaLinux and Rocky Linux (#836)