Prevent writing of different ressources.list files with same content … #761
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…in debian
It turned out that the changes made in #757 created new files in /etc/apt/sources.list.d/ called
datadog_apt_A2923DFF56EDA6E76E55E492D3A80E30382E94DE.list
anddatadog_apt_D75CEA17048B9ACBF186794B32637D44F14F620E.list
with the same content. This will cause the following warning message to appear each time an apt update is run:W: Target Packages (7/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list.d/datadog.list:1 and /etc/apt/sources.list.d/datadog_apt_A2923DFF56EDA6E76E55E492D3A80E30382E94DE.list:1 W: Target Packages (7/binary-all/Packages) is configured multiple times in /etc/apt/sources.list.d/datadog.list:1 and /etc/apt/sources.list.d/datadog_apt_A2923DFF56EDA6E76E55E492D3A80E30382E94DE.list:1 W: Target Translations (7/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list.d/datadog.list:1 and /etc/apt/sources.list.d/datadog_apt_A2923DFF56EDA6E76E55E492D3A80E30382E94DE.list:1 W: Target Translations (7/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list.d/datadog.list:1 and /etc/apt/sources.list.d/datadog_apt_A2923DFF56EDA6E76E55E492D3A80E30382E94DE.list:1 W: Target Packages (7/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list.d/datadog.list:1 and /etc/apt/sources.list.d/datadog_apt_D75CEA17048B9ACBF186794B32637D44F14F620E.list:1 W: Target Packages (7/binary-all/Packages) is configured multiple times in /etc/apt/sources.list.d/datadog.list:1 and /etc/apt/sources.list.d/datadog_apt_D75CEA17048B9ACBF186794B32637D44F14F620E.list:1 W: Target Translations (7/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list.d/datadog.list:1 and /etc/apt/sources.list.d/datadog_apt_D75CEA17048B9ACBF186794B32637D44F14F620E.list:1 W: Target Translations (7/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list.d/datadog.list:1 and /etc/apt/sources.list.d/datadog_apt_D75CEA17048B9ACBF186794B32637D44F14F620E.list:1 W: Target Packages (7/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list.d/datadog.list:1 and /etc/apt/sources.list.d/datadog_apt_A2923DFF56EDA6E76E55E492D3A80E30382E94DE.list:1 W: Target Packages (7/binary-all/Packages) is configured multiple times in /etc/apt/sources.list.d/datadog.list:1 and /etc/apt/sources.list.d/datadog_apt_A2923DFF56EDA6E76E55E492D3A80E30382E94DE.list:1 W: Target Translations (7/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list.d/datadog.list:1 and /etc/apt/sources.list.d/datadog_apt_A2923DFF56EDA6E76E55E492D3A80E30382E94DE.list:1 W: Target Translations (7/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list.d/datadog.list:1 and /etc/apt/sources.list.d/datadog_apt_A2923DFF56EDA6E76E55E492D3A80E30382E94DE.list:1 W: Target Packages (7/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list.d/datadog.list:1 and /etc/apt/sources.list.d/datadog_apt_D75CEA17048B9ACBF186794B32637D44F14F620E.list:1 W: Target Packages (7/binary-all/Packages) is configured multiple times in /etc/apt/sources.list.d/datadog.list:1 and /etc/apt/sources.list.d/datadog_apt_D75CEA17048B9ACBF186794B32637D44F14F620E.list:1 W: Target Translations (7/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list.d/datadog.list:1 and /etc/apt/sources.list.d/datadog_apt_D75CEA17048B9ACBF186794B32637D44F14F620E.list:1 W: Target Translations (7/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list.d/datadog.list:1 and /etc/apt/sources.list.d/datadog_apt_D75CEA17048B9ACBF186794B32637D44F14F620E.list:1
apt update runs through, but it doesn't make sense to me why there should be multiple files with the same mirror specifications as content. To add multiple apt keys it's needed to use the apt-repository resource in Chef. The resource automatically wants to add the sources.list.d files, which have the same content while getting added using each.do. As it looks like there is no way to add only the keys to the system without creating a file in sources.list.d (since :add is set by default) and then adding one file with the mirror content.
So it only makes sense to add a key (the one with the longer runtime) and use the file /etc/apt/sources.list.d/datadog.list again, otherwise systems using the cookbook before version 4.7.2 and then upgrading to 4.7.2 will find three files with the same content in sources.list.d:
Another advantage of using uniform file names is the scalability and thus the exchangeability of file contents, as well as the reduction of redundancies such as in file names.