From ffaf102fecc20510513de4898ce85b5b119e1795 Mon Sep 17 00:00:00 2001 From: Marcin Juszkiewicz Date: Tue, 6 Apr 2021 13:14:49 +0200 Subject: Debian/Ubuntu: handle APT keys in proper way apt-key is deprecated and in Debian 'bullseye' it complain when we use it the way we did. The right way is to store key files in separate directory and then, for each repo source file, point to proper key. And this is what this patch does. Both distros use the same keys now. More info: https://michael-prokop.at/blog/2021/02/16/how-to-properly-use-3rd-party-debian-repository-signing-keys-with-apt/ Change-Id: Ie19bf46236907d79cb42a5e94cd1067e952b8cbb --- kolla/template/methods.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'kolla/template/methods.py') diff --git a/kolla/template/methods.py b/kolla/template/methods.py index 69434ef50..9f15cc528 100644 --- a/kolla/template/methods.py +++ b/kolla/template/methods.py @@ -115,8 +115,16 @@ def handle_repos(context, reponames, mode): commands += ' %s %s' % (rpm_switch, repo_list[repo]) elif base_package_type == 'deb': if mode == 'enable': - commands += 'echo "%s" ' % repo_list[repo] - commands += '>/etc/apt/sources.list.d/%s.list && ' % repo + commands += f"""echo 'Uris: {repo_list[repo]['url']}' \ +>/etc/apt/sources.list.d/{repo}.sources \ +&& echo 'Components: {repo_list[repo]['component']}' \ +>>/etc/apt/sources.list.d/{repo}.sources \ +&& echo 'Types: deb' >>/etc/apt/sources.list.d/{repo}.sources \ +&& echo 'Suites: {repo_list[repo]['suite']}' \ +>>/etc/apt/sources.list.d/{repo}.sources \ +&& echo 'Signed-By: /etc/kolla/apt-keys/{repo_list[repo]['gpg_key']}' \ +>>/etc/apt/sources.list.d/{repo}.sources \ +&& """ except KeyError: # NOTE(hrw): we ignore missing repositories for a given # distro/arch -- cgit v1.2.3