Skip to content

Commit 6f680f1

Browse files
rzrglehmann
authored andcommitted
l/host.py: Fix issue that update from non declared repositories
While updating some pool, I noticed that some packages from non listed repo were also updated, this is caused by previously enabled repos on host. This behavior makes the update unpredictable (unless if all/undesired repos are disabled on host explicitly before the update). With this change all desired repos must be explicitly declared into inventory file, non declared repos will not be used anymore. To reproduce the issue, on an fresh host do the update with [default] repositories = ["xcp-ng-base","xcp-ng-testing", "xcp-ng-candidates"] [hosts."$host"] Then: ssh root@$host yum-config-manager --enable "xcp-ng-ci" And run same update again: ci packages will be pulled while not desired in the inventory file. Signed-off-by: Philippe Coval <philippe.coval@vates.tech>
1 parent 7361a37 commit 6f680f1

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

lib/host.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -518,16 +518,16 @@ def yum_update(self, enablerepos: list[str] = []) -> str:
518518
519519
yum update -y
520520
# with enablerepos
521-
yum update -y --enablerepo=extra1 --enablerepos=extra2
521+
yum update -y --disablerepo='*' --enablerepo=extra1 --enablerepos=extra2
522522
523-
:param enablerepos: Enable one or more repositories (default: []).
523+
:param enablerepos: Enable one or more repositories (default: []) if present disable other repos
524524
"""
525525
base_command = "yum update -y"
526526

527527
logging.info(f"[{self}] Updating packages...")
528528
if enablerepos:
529529
extra = " ".join(f"--enablerepo={r}" for r in enablerepos)
530-
base_command = f"{base_command} {extra}"
530+
base_command = f"{base_command} --disablerepo='*' {extra}"
531531

532532
return self.ssh(base_command)
533533

0 commit comments

Comments
 (0)