From 2d07295d8cd08b05daf8ecf7ba064f5fa9e8c6a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Sat, 25 Apr 2026 19:04:20 -0300 Subject: [PATCH] fix: skip empty local-repository.tmpl in nodeset When a pkgdir has no valid repodata, Yum.pm creates an empty local-repository.tmpl file. Template.pm then reads it and generates an empty yum repo config block in the kickstart. Adding a -s check skips empty template files instead of silently including them. Revives the fix from PR #4769 which was closed without merging. Fixes #3572 --- xCAT-server/lib/perl/xCAT/Template.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm index 27ae00094..d133db725 100644 --- a/xCAT-server/lib/perl/xCAT/Template.pm +++ b/xCAT-server/lib/perl/xCAT/Template.pm @@ -312,7 +312,7 @@ sub subvars { $source .= "repo --name=pkg$c --baseurl=http://#TABLE:noderes:\$NODE:nfsserver#$httpportsuffix/$pkgdir\n"; #for rhels5.9 } my $distrepofile="/install/postscripts/repos/$pkgdir/local-repository.tmpl"; - if( -f "$distrepofile"){ + if( -f "$distrepofile" and -s "$distrepofile"){ my $repofd; my $repo_in_post; local $/=undef;