Skip to content

Commit e276200

Browse files
committed
update tool: sync xcpng-users.repo from koji before update
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 <gaetan.lehmann@vates.tech>
1 parent 99364ae commit e276200

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

lib/tools/tasks/update.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,20 @@ def _pinned_updates_repo(host: Host) -> Generator[None]:
133133
logger.info(f"[{host}] Restoring {repo_file}")
134134
host.ssh(f'mv -f {backup_file} {repo_file}')
135135

136+
def _sync_users_repo(host: Host) -> None:
137+
"""Copy the koji xcpng-users.repo file on the host to keep repository definitions in sync."""
138+
repo_url = (
139+
f'https://koji.xcp-ng.org/repos/user/{host.xcp_version.major}/{host.xcp_version_short}/xcpng-users.repo'
140+
)
141+
repo_file = '/etc/yum.repos.d/xcpng-users.repo'
142+
logger.info(f"[{host}] Downloading {repo_url} to {repo_file}")
143+
host.ssh(f"curl -fsS -o {repo_file} '{repo_url}'")
144+
136145
def _update_host(host: Host, enablerepos: list[str], disablerepos: list[str] = [],
137146
reboot: bool = True) -> None:
138147
"""Update a host, with the mirrors.xcp-ng.org baseurl removed during the update."""
139148
with _pinned_updates_repo(host):
149+
_sync_users_repo(host)
140150
host.update(enablerepos, disablerepos=disablerepos, reboot=reboot)
141151

142152
def update_pools(inventory: Inventory, reboot: bool = True, parallel: bool = False) -> None:

0 commit comments

Comments
 (0)