Prevent writing of different list files with same content in debian
MODIFY
recipes/repository.rb
recipes/repository.rb
@@ -28,7 +28,7 @@ agent_major_version = Chef::Datadog.agent_major_version(node)
# A2923DFF56EDA6E76E55E492D3A80E30382E94DE expires in 2022
# D75CEA17048B9ACBF186794B32637D44F14F620E expires in 2032
-apt_gpg_keys = ['A2923DFF56EDA6E76E55E492D3A80E30382E94DE', 'D75CEA17048B9ACBF186794B32637D44F14F620E']
+apt_gpg_key = 'A2923DFF56EDA6E76E55E492D3A80E30382E94DE'
# DATADOG_RPM_KEY_E09422B3.public expires in 2022
# DATADOG_RPM_KEY_20200908.public expires in 2024
@@ -65,8 +65,7 @@ when 'debian'
retries = node['datadog']['aptrepo_retries']
keyserver = node['datadog']['aptrepo_use_backup_keyserver'] ? node['datadog']['aptrepo_backup_keyserver'] : node['datadog']['aptrepo_keyserver']
# Add APT repositories
- apt_gpg_keys.each do |apt_gpg_key|
- apt_repository "datadog_apt_#{apt_gpg_key}" do
+ apt_repository 'datadog' do
keyserver keyserver
key apt_gpg_key
uri node['datadog']['aptrepo']
@@ -75,7 +74,6 @@ when 'debian'
action :add
retries retries
end
- end
# Previous versions of the cookbook could create this repo file, make sure we remove it now
apt_repository 'datadog-beta' do

MODIFY
spec/repository_spec.rb
spec/repository_spec.rb
@@ -15,17 +15,11 @@ describe 'datadog::repository' do
end
it 'sets up an apt repo with fingerprint A2923DFF56EDA6E76E55E492D3A80E30382E94DE' do
- expect(chef_run).to add_apt_repository('datadog_apt_A2923DFF56EDA6E76E55E492D3A80E30382E94DE').with(
+ expect(chef_run).to add_apt_repository('datadog').with(
key: ['A2923DFF56EDA6E76E55E492D3A80E30382E94DE']
)
end
- it 'sets up an apt repo with fingerprint D75CEA17048B9ACBF186794B32637D44F14F620E' do
- expect(chef_run).to add_apt_repository('datadog_apt_D75CEA17048B9ACBF186794B32637D44F14F620E').with(
- key: ['D75CEA17048B9ACBF186794B32637D44F14F620E']
- )
- end
-
it 'removes the datadog-beta repo' do
expect(chef_run).to remove_apt_repository('datadog-beta')
end

Prevent writing of different list files with same content in debian (#761)