Skip to content

Commit 56a463c

Browse files
author
Slavek Kabrda
committed
Support AlmaLinux and Rocky Linux with Chef >= 7.12.0
1 parent 0070680 commit 56a463c

7 files changed

Lines changed: 108 additions & 3 deletions

File tree

.circleci/config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,13 @@ jobs:
227227
RUBY_VERSION: '2.6.3'
228228
PUPPET_VERSION: '7.9.0'
229229

230+
specs-ruby26-puppet714:
231+
<<: *specs
232+
environment:
233+
STRICT_VARIABLES: 'yes'
234+
RUBY_VERSION: '2.6.3'
235+
PUPPET_VERSION: '7.14.0'
236+
230237
specs-ruby25-puppet65-windows: &windows-specs
231238
executor:
232239
name: win/default # Comes with ruby 2.6, which is not supported on Windows as of puppet 6.10.1
@@ -325,5 +332,6 @@ workflows:
325332
- specs-ruby26-puppet60
326333
- specs-ruby26-puppet65
327334
- specs-ruby26-puppet79
335+
- specs-ruby26-puppet714
328336
- verify-gemfile-lock-dependencies
329337
- kitchen-tests

kitchen.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,25 @@ platforms:
5050
- gem install r10k -v 2.6.7
5151
- cd /home/kitchen/puppet && r10k puppetfile install --moduledir=/tmp/modules
5252

53+
- name: rocky-8-puppet-5
54+
driver_config:
55+
# we use a custom image that runs systemd
56+
image: 'datadog/docker-library:chef_kitchen_systemd_rocky_8'
57+
platform: rhel # kitchen-docker doesn't recognize rocky otherwise
58+
run_command: /root/start.sh
59+
driver:
60+
provision_command:
61+
- dnf install -y https://yum.puppetlabs.com/puppet7-release-el-8.noarch.rpm #installs the puppet-agent repo
62+
- dnf install -y puppet-agent rubygems
63+
- ln -s /opt/puppetlabs/bin/puppet /usr/bin/puppet
64+
65+
- mkdir /home/kitchen/puppet
66+
- printf <%= File.read('environments/etc/Puppetfile').inspect %> > /home/kitchen/puppet/Puppetfile
67+
68+
- gem install bundler -v '= 1.17.3'
69+
- gem install r10k -v 2.6.7
70+
- cd /home/kitchen/puppet && r10k puppetfile install --moduledir=/tmp/modules
71+
5372
- name: ubuntu-1604-puppet-6
5473
driver_config:
5574
# we use the official image

manifests/init.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@
441441
skip_apt_key_trusting => $skip_apt_key_trusting,
442442
}
443443
}
444-
'RedHat','CentOS','Fedora','Amazon','Scientific','OracleLinux' : {
444+
'RedHat','CentOS','Fedora','Amazon','Scientific','OracleLinux','AlmaLinux','Rocky' : {
445445
class { 'datadog_agent::redhat':
446446
agent_major_version => $_agent_major_version,
447447
agent_flavor => $agent_flavor,

manifests/params.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
$permissions_protected_file = '0600'
3939
$agent_binary = '/opt/datadog-agent/bin/agent/agent'
4040
}
41-
'RedHat','CentOS','Fedora','Amazon','Scientific','OracleLinux', 'OpenSuSE', 'SLES' : {
41+
'RedHat','CentOS','Fedora','Amazon','Scientific','OracleLinux', 'AlmaLinux', 'Rocky', 'OpenSuSE', 'SLES' : {
4242
$rubydev_package = 'ruby-devel'
4343
$legacy_conf_dir = '/etc/dd-agent/conf.d'
4444
$conf_dir = '/etc/datadog-agent/conf.d'

metadata.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,18 @@
6363
"7"
6464
]
6565
},
66+
{
67+
"operatingsystem": "AlmaLinux",
68+
"operatingsystemrelease": [
69+
"8"
70+
]
71+
},
72+
{
73+
"operatingsystem": "Rocky",
74+
"operatingsystemrelease": [
75+
"8"
76+
]
77+
},
6678
{
6779
"operatingsystem": "Scientific",
6880
"operatingsystemrelease": [

spec/classes/datadog_agent_redhat_spec.rb

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,4 +219,66 @@
219219
end
220220
end
221221
end
222+
223+
context 'almalinux 8', if: min_puppet_version('7.12.0') do
224+
let(:facts) do
225+
{
226+
osfamily: 'redhat',
227+
operatingsystem: 'AlmaLinux',
228+
operatingsystemrelease: '8.5',
229+
architecture: 'x86_64',
230+
}
231+
end
232+
233+
# it should install the repo
234+
context 'with manage_repo => true' do
235+
let(:params) do
236+
{
237+
manage_repo: true, agent_major_version: 7
238+
}
239+
end
240+
241+
it do
242+
is_expected.to contain_yumrepo('datadog')
243+
.with_enabled(1)\
244+
.with_gpgcheck(1)\
245+
.with_gpgkey('https://keys.datadoghq.com/DATADOG_RPM_KEY_CURRENT.public
246+
https://keys.datadoghq.com/DATADOG_RPM_KEY_E09422B3.public
247+
https://keys.datadoghq.com/DATADOG_RPM_KEY_FD4BF915.public')\
248+
.with_baseurl('https://yum.datadoghq.com/stable/7/x86_64/')\
249+
.with_repo_gpgcheck(true)
250+
end
251+
end
252+
end
253+
254+
context 'rocky 8', if: min_puppet_version('7.12.0') do
255+
let(:facts) do
256+
{
257+
osfamily: 'redhat',
258+
operatingsystem: 'Rocky',
259+
operatingsystemrelease: '8.5',
260+
architecture: 'x86_64',
261+
}
262+
end
263+
264+
# it should install the repo
265+
context 'with manage_repo => true' do
266+
let(:params) do
267+
{
268+
manage_repo: true, agent_major_version: 7
269+
}
270+
end
271+
272+
it do
273+
is_expected.to contain_yumrepo('datadog')
274+
.with_enabled(1)\
275+
.with_gpgcheck(1)\
276+
.with_gpgkey('https://keys.datadoghq.com/DATADOG_RPM_KEY_CURRENT.public
277+
https://keys.datadoghq.com/DATADOG_RPM_KEY_E09422B3.public
278+
https://keys.datadoghq.com/DATADOG_RPM_KEY_FD4BF915.public')\
279+
.with_baseurl('https://yum.datadoghq.com/stable/7/x86_64/')\
280+
.with_repo_gpgcheck(true)
281+
end
282+
end
283+
end
222284
end

spec/spec_helper.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require 'puppetlabs_spec_helper/module_spec_helper'
22

33
DEBIAN_OS = ['Ubuntu', 'Debian'].freeze
4-
REDHAT_OS = ['RedHat', 'CentOS', 'Fedora', 'Amazon', 'Scientific', 'OracleLinux'].freeze
4+
REDHAT_OS = ['RedHat', 'CentOS', 'Fedora', 'Amazon', 'Scientific', 'OracleLinux', 'AlmaLinux', 'Rocky'].freeze
55
WINDOWS_OS = ['Windows'].freeze
66

77
if RSpec::Support::OS.windows?
@@ -26,6 +26,10 @@
2626
PERMISSIONS_PROTECTED_FILE = '0600'.freeze
2727
end
2828

29+
def min_puppet_version(version)
30+
Gem.loaded_specs['puppet'].version > Gem::Version.new(version)
31+
end
32+
2933
def getosfamily(operatingsystem)
3034
if DEBIAN_OS.include?(operatingsystem)
3135
'debian'

0 commit comments

Comments
 (0)