Skip to content

Commit 7e942d6

Browse files
KSerraniaSlavek Kabrda
and
Slavek Kabrda
authored
Stop adding old GPG key 4172a230 (#770)
Co-authored-by: Slavek Kabrda <slavek.kabrda@datadoghq.com>
1 parent 768540f commit 7e942d6

File tree

6 files changed

+50
-34
lines changed

6 files changed

+50
-34
lines changed

kitchen.yml

+24-24
Original file line numberDiff line numberDiff line change
@@ -72,30 +72,30 @@ platforms:
7272
- gem install multipart-post:2.1.1 r10k:2.6.7
7373
- cd /home/kitchen/puppet && r10k puppetfile install --moduledir=/tmp/modules
7474

75-
- name: opensuse/leap-15
76-
# Workaround for flakes on initializing opensuse/leap-15:
77-
# => SCP did not finish successfully (255): (Net::SCP::Error)
78-
transport:
79-
max_ssh_sessions: 1
80-
driver_config:
81-
# we use a custom image that runs systemd
82-
image: 'datadog/docker-library:chef_kitchen_systemd_opensuse_leap_15'
83-
run_command: /root/start.sh
84-
85-
driver:
86-
provision_command:
87-
- zypper ar -G https://yum.puppet.com/puppet/sles/15/x86_64/ puppet-repo
88-
- zypper install -y puppet-agent ruby=2.5
89-
- gem install bundler -v '= 1.17.3'
90-
- gem install net-ssh -v '= 6.1.0'
91-
- gem install serverspec rspec
92-
- ln -s /usr/bin/rspec.ruby2.5 /usr/bin/rspec
93-
- ln -s /opt/puppetlabs/puppet/bin/puppet /usr/bin/puppet
94-
- mkdir /home/kitchen/puppet
95-
- printf <%= File.read('environments/etc/Puppetfile').inspect %> > /home/kitchen/puppet/Puppetfile
96-
97-
- /opt/puppetlabs/puppet/bin/gem install multipart-post:2.1.1 r10k:2.6.7
98-
- cd /home/kitchen/puppet && /opt/puppetlabs/puppet/bin/r10k puppetfile install --moduledir=/tmp/modules
75+
# - name: opensuse/leap-15
76+
# # Workaround for flakes on initializing opensuse/leap-15:
77+
# # => SCP did not finish successfully (255): (Net::SCP::Error)
78+
# transport:
79+
# max_ssh_sessions: 1
80+
# driver_config:
81+
# # we use a custom image that runs systemd
82+
# image: 'datadog/docker-library:chef_kitchen_systemd_opensuse_leap_15'
83+
# run_command: /root/start.sh
84+
#
85+
# driver:
86+
# provision_command:
87+
# - zypper ar -G https://yum.puppet.com/puppet/sles/15/x86_64/ puppet-repo
88+
# - zypper install -y puppet-agent ruby=2.5
89+
# - gem install bundler -v '= 1.17.3'
90+
# - gem install net-ssh -v '= 6.1.0'
91+
# - gem install serverspec rspec
92+
# - ln -s /usr/bin/rspec.ruby2.5 /usr/bin/rspec
93+
# - ln -s /opt/puppetlabs/puppet/bin/puppet /usr/bin/puppet
94+
# - mkdir /home/kitchen/puppet
95+
# - printf <%= File.read('environments/etc/Puppetfile').inspect %> > /home/kitchen/puppet/Puppetfile
96+
#
97+
# - /opt/puppetlabs/puppet/bin/gem install multipart-post:2.1.1 r10k:2.6.7
98+
# - cd /home/kitchen/puppet && /opt/puppetlabs/puppet/bin/r10k puppetfile install --moduledir=/tmp/modules
9999

100100
verifier:
101101
name: serverspec

manifests/redhat.pp

+7-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
'https://keys.datadoghq.com/DATADOG_RPM_KEY_CURRENT.public',
1919
'https://keys.datadoghq.com/DATADOG_RPM_KEY_E09422B3.public',
2020
'https://keys.datadoghq.com/DATADOG_RPM_KEY_FD4BF915.public',
21-
'https://keys.datadoghq.com/DATADOG_RPM_KEY.public',
2221
]
22+
2323
if ($rpm_repo_gpgcheck != undef) {
2424
$repo_gpgcheck = $rpm_repo_gpgcheck
2525
} else {
@@ -54,7 +54,7 @@
5454
}
5555
7 : {
5656
$defaulturl = "https://yum.datadoghq.com/stable/7/${::architecture}/"
57-
$gpgkeys = $keys[0,-2]
57+
$gpgkeys = $keys
5858
}
5959
default: { fail('invalid agent_major_version') }
6060
}
@@ -65,6 +65,11 @@
6565
$baseurl = $defaulturl
6666
}
6767

68+
exec { 'ensure key 4172A230 is removed from the RPM database':
69+
command => '/bin/rpm --erase gpg-pubkey-4172a230-55dd14f6',
70+
onlyif => '/bin/rpm -q gpg-pubkey-4172a230-55dd14f6',
71+
}
72+
6873
yumrepo { 'datadog-beta':
6974
ensure => absent,
7075
}

manifests/suse.pp

+6-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
$current_key,
1818
'https://keys.datadoghq.com/DATADOG_RPM_KEY_E09422B3.public',
1919
'https://keys.datadoghq.com/DATADOG_RPM_KEY_FD4BF915.public',
20-
'https://keys.datadoghq.com/DATADOG_RPM_KEY.public',
2120
]
2221

2322
if ($rpm_repo_gpgcheck != undef) {
@@ -33,7 +32,7 @@
3332
case $agent_major_version {
3433
5 : { fail('Agent v5 package not available in SUSE') }
3534
6 : { $gpgkeys = $all_keys }
36-
7 : { $gpgkeys = $all_keys[0,-2] }
35+
7 : { $gpgkeys = $all_keys }
3736
default: { fail('invalid agent_major_version') }
3837
}
3938

@@ -66,6 +65,11 @@
6665
}
6766
}
6867

68+
exec { 'ensure key 4172A230 is removed from the RPM database':
69+
command => '/bin/rpm --erase gpg-pubkey-4172a230-55dd14f6',
70+
onlyif => '/bin/rpm -q gpg-pubkey-4172a230-55dd14f6',
71+
}
72+
6973
zypprepo { 'datadog':
7074
baseurl => $baseurl,
7175
enabled => 1,

spec/classes/datadog_agent_redhat_spec.rb

+2-4
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@
2929
.with_gpgcheck(1)\
3030
.with_gpgkey('https://keys.datadoghq.com/DATADOG_RPM_KEY_CURRENT.public
3131
https://keys.datadoghq.com/DATADOG_RPM_KEY_E09422B3.public
32-
https://keys.datadoghq.com/DATADOG_RPM_KEY_FD4BF915.public
33-
https://keys.datadoghq.com/DATADOG_RPM_KEY.public')\
32+
https://keys.datadoghq.com/DATADOG_RPM_KEY_FD4BF915.public')\
3433
.with_baseurl('https://yum.datadoghq.com/rpm/x86_64/')\
3534
.with_repo_gpgcheck(false)
3635
end
@@ -78,8 +77,7 @@
7877
.with_gpgcheck(1)\
7978
.with_gpgkey('https://keys.datadoghq.com/DATADOG_RPM_KEY_CURRENT.public
8079
https://keys.datadoghq.com/DATADOG_RPM_KEY_E09422B3.public
81-
https://keys.datadoghq.com/DATADOG_RPM_KEY_FD4BF915.public
82-
https://keys.datadoghq.com/DATADOG_RPM_KEY.public')\
80+
https://keys.datadoghq.com/DATADOG_RPM_KEY_FD4BF915.public')\
8381
.with_baseurl('https://yum.datadoghq.com/stable/6/x86_64/')\
8482
.with_repo_gpgcheck(true)
8583
end

spec/classes/datadog_agent_suse_spec.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@
3232
.with_gpgcheck(1)\
3333
.with_gpgkey('https://keys.datadoghq.com/DATADOG_RPM_KEY_CURRENT.public
3434
https://keys.datadoghq.com/DATADOG_RPM_KEY_E09422B3.public
35-
https://keys.datadoghq.com/DATADOG_RPM_KEY_FD4BF915.public
36-
https://keys.datadoghq.com/DATADOG_RPM_KEY.public')\
35+
https://keys.datadoghq.com/DATADOG_RPM_KEY_FD4BF915.public')\
3736
.with_baseurl('https://yum.datadoghq.com/suse/stable/6/x86_64')
3837
# .with_repo_gpgcheck(true)
3938
end

test/integration/dd-agent/serverspec/default_spec.rb

+10
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,14 @@
99
it { is_expected.to be_enabled }
1010
it { is_expected.to be_running }
1111
end
12+
13+
describe command('rpm -q gpg-pubkey-4172a230-55dd14f6'), if: os[:family] == 'redhat' do
14+
its(:stdout) { is_expected.to match 'package gpg-pubkey-4172a230-55dd14f6 is not installed' }
15+
its(:exit_status) { is_expected.to eq 1 }
16+
end
17+
18+
describe command('rpm -q gpg-pubkey-4172a230-55dd14f6'), if: os[:family] == 'opensuse' do
19+
its(:stdout) { is_expected.to match 'package gpg-pubkey-4172a230-55dd14f6 is not installed' }
20+
its(:exit_status) { is_expected.to eq 1 }
21+
end
1222
end

0 commit comments

Comments
 (0)