From ece41b7a677341d5023eb3f5e4db7f5326cfc86c Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Thu, 6 May 2021 15:02:21 +0100 Subject: [PATCH] CentOS Stream: update DNF repo file names CentOS repositories were renamed following the separation of CentOS Linux and Stream. This change updates their names when using a local mirror. It also removes the old files. Change-Id: Ifcc3781d771e150b5771f2bf20cd8bcbc5faa443 Story: 2008795 Task: 42435 --- ansible/roles/dnf/tasks/local-mirror.yml | 10 ++++++++++ .../dnf/templates/CentOS-AppStream.repo.j2 | 19 ------------------ .../roles/dnf/templates/CentOS-Base.repo.j2 | 19 ------------------ .../roles/dnf/templates/CentOS-Extras.repo.j2 | 20 ------------------- .../templates/CentOS-Stream-AppStream.repo.j2 | 17 ++++++++++++++++ .../templates/CentOS-Stream-BaseOS.repo.j2 | 17 ++++++++++++++++ .../templates/CentOS-Stream-Extras.repo.j2 | 17 ++++++++++++++++ .../tests/test_overcloud_host_configure.py | 2 +- 8 files changed, 62 insertions(+), 59 deletions(-) delete mode 100644 ansible/roles/dnf/templates/CentOS-AppStream.repo.j2 delete mode 100644 ansible/roles/dnf/templates/CentOS-Base.repo.j2 delete mode 100644 ansible/roles/dnf/templates/CentOS-Extras.repo.j2 create mode 100644 ansible/roles/dnf/templates/CentOS-Stream-AppStream.repo.j2 create mode 100644 ansible/roles/dnf/templates/CentOS-Stream-BaseOS.repo.j2 create mode 100644 ansible/roles/dnf/templates/CentOS-Stream-Extras.repo.j2 diff --git a/ansible/roles/dnf/tasks/local-mirror.yml b/ansible/roles/dnf/tasks/local-mirror.yml index afc636390..845d50e96 100644 --- a/ansible/roles/dnf/tasks/local-mirror.yml +++ b/ansible/roles/dnf/tasks/local-mirror.yml @@ -7,6 +7,16 @@ group: root mode: 0664 become: True + loop: + - CentOS-Stream-AppStream.repo + - CentOS-Stream-BaseOS.repo + - CentOS-Stream-Extras.repo + +- name: Remove old (pre CentOS 8.3) repo files + file: + path: /etc/yum.repos.d/{{ item }} + state: absent + become: True loop: - CentOS-AppStream.repo - CentOS-Base.repo diff --git a/ansible/roles/dnf/templates/CentOS-AppStream.repo.j2 b/ansible/roles/dnf/templates/CentOS-AppStream.repo.j2 deleted file mode 100644 index a8bd6868f..000000000 --- a/ansible/roles/dnf/templates/CentOS-AppStream.repo.j2 +++ /dev/null @@ -1,19 +0,0 @@ -# CentOS-AppStream.repo -# -# The mirror system uses the connecting IP address of the client and the -# update status of each mirror to pick mirrors that are updated to and -# geographically close to the client. You should use this for CentOS updates -# unless you are manually picking other mirrors. -# -# If the mirrorlist= does not work for you, as a fall back you can try the -# remarked out baseurl= line instead. -# -# - -[AppStream] -name=CentOS-$releasever - AppStream -baseurl=http://{{ dnf_centos_mirror_host }}/{{ dnf_centos_mirror_directory }}/$releasever/AppStream/$basearch/os/ -gpgcheck=1 -enabled=1 -gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial -fastestmirror=0 diff --git a/ansible/roles/dnf/templates/CentOS-Base.repo.j2 b/ansible/roles/dnf/templates/CentOS-Base.repo.j2 deleted file mode 100644 index d0ad69526..000000000 --- a/ansible/roles/dnf/templates/CentOS-Base.repo.j2 +++ /dev/null @@ -1,19 +0,0 @@ -# CentOS-Base.repo -# -# The mirror system uses the connecting IP address of the client and the -# update status of each mirror to pick mirrors that are updated to and -# geographically close to the client. You should use this for CentOS updates -# unless you are manually picking other mirrors. -# -# If the mirrorlist= does not work for you, as a fall back you can try the -# remarked out baseurl= line instead. -# -# - -[BaseOS] -name=CentOS-$releasever - Base -baseurl=http://{{ dnf_centos_mirror_host }}/{{ dnf_centos_mirror_directory }}/$releasever/BaseOS/$basearch/os/ -gpgcheck=1 -enabled=1 -gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial -fastestmirror=0 diff --git a/ansible/roles/dnf/templates/CentOS-Extras.repo.j2 b/ansible/roles/dnf/templates/CentOS-Extras.repo.j2 deleted file mode 100644 index 686eec73d..000000000 --- a/ansible/roles/dnf/templates/CentOS-Extras.repo.j2 +++ /dev/null @@ -1,20 +0,0 @@ -# CentOS-Extras.repo -# -# The mirror system uses the connecting IP address of the client and the -# update status of each mirror to pick mirrors that are updated to and -# geographically close to the client. You should use this for CentOS updates -# unless you are manually picking other mirrors. -# -# If the mirrorlist= does not work for you, as a fall back you can try the -# remarked out baseurl= line instead. -# -# - -#additional packages that may be useful -[extras] -name=CentOS-$releasever - Extras -baseurl=http://{{ dnf_centos_mirror_host }}/{{ dnf_centos_mirror_directory }}/$releasever/extras/$basearch/os/ -gpgcheck=1 -enabled=1 -gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial -fastestmirror=0 diff --git a/ansible/roles/dnf/templates/CentOS-Stream-AppStream.repo.j2 b/ansible/roles/dnf/templates/CentOS-Stream-AppStream.repo.j2 new file mode 100644 index 000000000..667c6c85c --- /dev/null +++ b/ansible/roles/dnf/templates/CentOS-Stream-AppStream.repo.j2 @@ -0,0 +1,17 @@ +# CentOS-Stream-AppStream.repo +# +# The mirrorlist system uses the connecting IP address of the client and the +# update status of each mirror to pick current mirrors that are geographically +# close to the client. You should use this for CentOS updates unless you are +# manually picking other mirrors. +# +# If the mirrorlist does not work for you, you can try the commented out +# baseurl line instead. + +[appstream] +name=CentOS Stream $releasever - AppStream +baseurl=http://{{ dnf_centos_mirror_host }}/{{ dnf_centos_mirror_directory }}/$stream/AppStream/$basearch/os/ +gpgcheck=1 +enabled=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial +fastestmirror=0 diff --git a/ansible/roles/dnf/templates/CentOS-Stream-BaseOS.repo.j2 b/ansible/roles/dnf/templates/CentOS-Stream-BaseOS.repo.j2 new file mode 100644 index 000000000..1ba0747d6 --- /dev/null +++ b/ansible/roles/dnf/templates/CentOS-Stream-BaseOS.repo.j2 @@ -0,0 +1,17 @@ +# CentOS-Stream-BaseOS.repo +# +# The mirrorlist system uses the connecting IP address of the client and the +# update status of each mirror to pick current mirrors that are geographically +# close to the client. You should use this for CentOS updates unless you are +# manually picking other mirrors. +# +# If the mirrorlist does not work for you, you can try the commented out +# baseurl line instead. + +[baseos] +name=CentOS Stream $releasever - BaseOS +baseurl=http://{{ dnf_centos_mirror_host }}/{{ dnf_centos_mirror_directory }}/$stream/BaseOS/$basearch/os/ +gpgcheck=1 +enabled=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial +fastestmirror=0 diff --git a/ansible/roles/dnf/templates/CentOS-Stream-Extras.repo.j2 b/ansible/roles/dnf/templates/CentOS-Stream-Extras.repo.j2 new file mode 100644 index 000000000..d6b711c17 --- /dev/null +++ b/ansible/roles/dnf/templates/CentOS-Stream-Extras.repo.j2 @@ -0,0 +1,17 @@ +# CentOS-Stream-Extras.repo +# +# The mirrorlist system uses the connecting IP address of the client and the +# update status of each mirror to pick current mirrors that are geographically +# close to the client. You should use this for CentOS updates unless you are +# manually picking other mirrors. +# +# If the mirrorlist does not work for you, you can try the commented out +# baseurl line instead. + +[extras] +name=CentOS Stream $releasever - Extras +baseurl=http://{{ dnf_centos_mirror_host }}/{{ dnf_centos_mirror_directory }}/$stream/extras/$basearch/os/ +gpgcheck=1 +enabled=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial +fastestmirror=0 diff --git a/playbooks/kayobe-overcloud-host-configure-base/tests/test_overcloud_host_configure.py b/playbooks/kayobe-overcloud-host-configure-base/tests/test_overcloud_host_configure.py index a6662bcd7..0ec0d01db 100644 --- a/playbooks/kayobe-overcloud-host-configure-base/tests/test_overcloud_host_configure.py +++ b/playbooks/kayobe-overcloud-host-configure-base/tests/test_overcloud_host_configure.py @@ -171,7 +171,7 @@ def test_ntp_clock_synchronized(host): assert "synchronized: yes" in status_output -@pytest.mark.parametrize('repo', ["AppStream", "BaseOS", "Extras", "epel", +@pytest.mark.parametrize('repo', ["appstream", "baseos", "extras", "epel", "epel-modular"]) @pytest.mark.skipif(not _is_dnf(), reason="DNF only supported on CentOS 8") def test_dnf_local_package_mirrors(host, repo):