Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent writing of different ressources.list files with same content … #761

Conversation

nilskuehme
Copy link
Contributor

@nilskuehme nilskuehme commented Dec 7, 2020

…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 and datadog_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:

  • datadog_apt_A2923DFF56EDA6E76E55E492D3A80E30382E94DE.list
  • datadog_apt_D75CEA17048B9ACBF186794B32637D44F14F620E.list
  • datadog.list

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.

@nilskuehme nilskuehme requested a review from a team as a code owner December 7, 2020 18:37
Copy link
Contributor

@KSerrania KSerrania left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @nilskuehme,

Thanks for the report and the PR!

That's indeed a bug, we don't want to have multiple list files with the same content.

Since we do want to install both keys, we'll also have to find another way to install the other key before releasing a new version of the cookbook.

This PR looks good to me.

@nilskuehme
Copy link
Contributor Author

nilskuehme commented Dec 9, 2020

Hi @KSerrania , thank you for confirmation. I have seen your approval but unfortunately i'm not able to merge. Is this something you can do?

@KSerrania KSerrania merged commit cb12939 into DataDog:master Dec 9, 2020
@nilskuehme nilskuehme deleted the prevent-writing-of-different-ressources.listfiles-with-same-content-in-debian branch December 9, 2020 10:53
@nilskuehme
Copy link
Contributor Author

Great, thank you very much 👍

KSerrania added a commit that referenced this pull request Dec 9, 2020
Re-introduces the install of the new apt signing key D75CEA17048B9ACBF186794B32637D44F14F620E, removed in #761 because of a bug.
Cleans up superfluous repository files that may have been added by versions 4.7.0 and 4.7.2 of the cookbook.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants