From 231fadfaad1338c2afc9bfd9674ff6042c40f449 Mon Sep 17 00:00:00 2001
From: Daniel Hilst <392820+dhilst@users.noreply.github.com>
Date: Wed, 28 Oct 2026 11:07:37 -0300
Subject: [PATCH] fix(template): an IPv6 master is not bracketed in the
autoyast media_url
The media_url of an autoyast add-on product came from
"#TABLE:noderes:$NODE:nfsserver#", which substitutes the address of the
management node without brackets. An IPv6-only node therefore received
http://2001:db8::1//install/leap15.6/x86_64, and YaST
cannot read that as a URL, so the installer reached no repository.
_sles_media_url() uses the bracketed master host for a node with no IPv4 address
and keeps the substitution for every other node, which service nodes rely on.
xCAT-test/unit/template_ipv6_rendering.t fails its two IPv6 assertions when the
bracketed host is dropped.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
---
xCAT-server/lib/perl/xCAT/Template.pm | 30 ++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm
index 0f82d158c9..9c23271db7 100644
--- a/xCAT-server/lib/perl/xCAT/Template.pm
+++ b/xCAT-server/lib/perl/xCAT/Template.pm
@@ -59,6 +59,34 @@ sub httpport_suffix {
return xCAT::HTTPUtils::httpport_suffix($httpport);
}
+#-------------------------------------------------------------------------------
+
+=head3 _sles_media_url
+
+ The media_url of an autoyast add-on product.
+
+ Arguments:
+ $node_ipv6_only - whether the node has no IPv4 address
+ $master_host - the master host, already bracketed when it is IPv6
+ $httpportsuffix - the port suffix, empty on port 80
+ $pkgdir - the package directory
+ Returns:
+ the URL YaST installs the product from.
+
+ The table substitution writes the address of the management node as it
+ stands, and "http://2001:db8::1//install" is not a URL YaST can read. A node
+ that has IPv4 keeps the substitution, which service nodes rely on.
+
+=cut
+
+#-------------------------------------------------------------------------------
+sub _sles_media_url {
+ my ($node_ipv6_only, $master_host, $httpportsuffix, $pkgdir) = @_;
+
+ my $host = $node_ipv6_only ? $master_host : '#TABLE:noderes:$NODE:nfsserver#';
+ return "http://$host$httpportsuffix/$pkgdir";
+}
+
sub _dynamic_kickstart_network
{
my ($suffix, $ipv6_only) = @_;
@@ -402,7 +430,7 @@ sub subvars {
$writerepo .="EOF\n";
}
} elsif ($platform =~ /^(sles|suse|leap15)/) {
- my $http = "http://#TABLE:noderes:\$NODE:nfsserver#$httpportsuffix/$pkgdir";
+ my $http = _sles_media_url($node_ipv6_only, $master_uri_host, $httpportsuffix, $pkgdir);
$source .= "
$http
SuSE-Linux-pkg$c