From b06a658ed95b0131b1a28ae0416a2555a048b5fc Mon Sep 17 00:00:00 2001 From: Thomas Bellman <bellman@nsc.liu.se> Date: Tue, 1 Apr 2025 16:52:12 +0200 Subject: [PATCH] Use CentOS Vault for old CentOS versions. For older, retired, CentOS versions, the URLs in the Yum repo files provided by the centos-release-xen* packages are no longer valid, as they point to old locations before that CentOS version was retired. To handle this, we here let the xen::xen4centos::yumrepo::install class edit the repo file to point to NSC's CentOS Vault mirror, Vault being where CentOS publishes old version of their releases. --- manifests/xen4centos/yumrepo/install.pp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/manifests/xen4centos/yumrepo/install.pp b/manifests/xen4centos/yumrepo/install.pp index 525f4db..b94437b 100644 --- a/manifests/xen4centos/yumrepo/install.pp +++ b/manifests/xen4centos/yumrepo/install.pp @@ -31,6 +31,20 @@ define xen::xen4centos::yumrepo::install( "centos-release-xen${versiontag}": ensure => installed; } + # Point to a CentOS Vault mirror for older CentOS versions. + if (versioncmp($::operatingsystemrelease, 8) < 0) + { + include pkgrepos::vars + $repofile = "/etc/yum.repos.d/CentOS-Xen${versiontag}.repo" + $vault_url = "${pkgrepos::vars::centos_vault_base}/${pkgrepos::vars::eol_rhel_last_version}" + + regexp_replace_lines { + 'xen::xen4centos::yumrepo::centos-vault': + file => $repofile, + pattern => '^baseurl=https?://[^/]*/centos/.*/virt/(.*)', + replacement => "baseurl=${vault_url}/virt/\\1"; + } + } } elsif ($ensure == 'absent') { -- GitLab