From e2762000881e3082c66f1a799f62a4acee2beac8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Lehmann?= Date: Thu, 27 Aug 2026 16:20:39 +0200 Subject: [PATCH] update tool: sync xcpng-users.repo from koji before update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Download the koji xcpng-users.repo file on each host before running the update, to keep repository definitions in sync with koji. The URL is built from the host version. Signed-off-by: Gaƫtan Lehmann --- lib/tools/tasks/update.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/tools/tasks/update.py b/lib/tools/tasks/update.py index 2875c3a03..574dc2963 100644 --- a/lib/tools/tasks/update.py +++ b/lib/tools/tasks/update.py @@ -133,10 +133,20 @@ def _pinned_updates_repo(host: Host) -> Generator[None]: logger.info(f"[{host}] Restoring {repo_file}") host.ssh(f'mv -f {backup_file} {repo_file}') +def _sync_users_repo(host: Host) -> None: + """Copy the koji xcpng-users.repo file on the host to keep repository definitions in sync.""" + repo_url = ( + f'https://koji.xcp-ng.org/repos/user/{host.xcp_version.major}/{host.xcp_version_short}/xcpng-users.repo' + ) + repo_file = '/etc/yum.repos.d/xcpng-users.repo' + logger.info(f"[{host}] Downloading {repo_url} to {repo_file}") + host.ssh(f"curl -fsS -o {repo_file} '{repo_url}'") + def _update_host(host: Host, enablerepos: list[str], disablerepos: list[str] = [], reboot: bool = True) -> None: """Update a host, with the mirrors.xcp-ng.org baseurl removed during the update.""" with _pinned_updates_repo(host): + _sync_users_repo(host) host.update(enablerepos, disablerepos=disablerepos, reboot=reboot) def update_pools(inventory: Inventory, reboot: bool = True, parallel: bool = False) -> None: