Skip to content

Commit db37491

Browse files
committed
tools: install tmp-ci.repo on hosts before update
This repository is disabled by default and can be activated when needed. Signed-off-by: Gaëtan Lehmann <gaetan.lehmann@vates.tech>
1 parent e276200 commit db37491

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

lib/tools/tasks/update.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from collections.abc import Generator
99
from concurrent.futures import ThreadPoolExecutor, as_completed
1010
from contextlib import contextmanager
11+
from textwrap import dedent
1112

1213
from lib.host import Host
1314
from lib.pool import NotAMasterHostError, Pool
@@ -142,11 +143,24 @@ def _sync_users_repo(host: Host) -> None:
142143
logger.info(f"[{host}] Downloading {repo_url} to {repo_file}")
143144
host.ssh(f"curl -fsS -o {repo_file} '{repo_url}'")
144145

146+
def _install_tmp_ci_repo(host: Host) -> None:
147+
"""Install the tmp-ci.repo file on the host."""
148+
repo_file = '/etc/yum.repos.d/tmp-ci.repo'
149+
logger.info(f"[{host}] Writing {repo_file}")
150+
host.create_file(repo_file, dedent("""\
151+
[xcp-ng-tmp-ci]
152+
name=XCP-ng tmp CI
153+
baseurl=http://repos.lyon.vates.team/repos/tmp-ci/8.3/
154+
enabled=0
155+
gpgcheck=0
156+
"""))
157+
145158
def _update_host(host: Host, enablerepos: list[str], disablerepos: list[str] = [],
146159
reboot: bool = True) -> None:
147160
"""Update a host, with the mirrors.xcp-ng.org baseurl removed during the update."""
148161
with _pinned_updates_repo(host):
149162
_sync_users_repo(host)
163+
_install_tmp_ci_repo(host)
150164
host.update(enablerepos, disablerepos=disablerepos, reboot=reboot)
151165

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

0 commit comments

Comments
 (0)