2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-11-23 10:52:29 +00:00

fix(xcat-core): an openSUSE management node is not recognised, so no case runs

current_os reads /etc/os-release and returns undef for openSUSE. The word sles
appears nowhere in Leap's os-release -- ID is opensuse-leap on 15.x and
opensuse on 42.3 -- and Leap ships none of /etc/redhat-release,
/etc/lsb-release or /etc/SuSE-release, so no other arm is reached. xcattest
rejects every case on the resulting undef, and 328 of the shipped cases declare
os:Linux.

openSUSE now answers with the SLE family whose package set it shares, which is
the answer decided on 2026-09-18 for the same bug: sles.pm claims leap15 and
xcat.org publishes the Leap dependencies under sles15. It also lets the 18
cases written os:sles select a Leap node, which a name of its own would not.
current_os has one consumer -- the os: comparison at xcattest:1052 -- so the
answer affects nothing else.

The match is on the whole file rather than on ID alone, because Leap 42.3
spells its ID opensuse and Tumbleweed opensuse-tumbleweed. It is placed after
the sles test, so a real SLES node is unaffected.

xcattest_os_selection.t passes, 19 of 19. Reverting this file alone fails its
five openSUSE assertions and nothing else.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
Daniel Hilst
2026-10-24 17:52:34 -03:00
parent 2c56d3d2e8
commit f47541e19b
+7
View File
@@ -49,6 +49,13 @@ sub current_os {
if (-f "$root/etc/os-release") {
my $text = _slurp("$root/etc/os-release") // '';
return 'sles' if $text =~ /sles/;
# openSUSE answers with the SLE family whose package set it shares: sles.pm claims
# leap15 and xcat.org publishes the Leap dependencies under sles15. Leap's os-release
# says ID="opensuse-leap" and carries no SLES string, and Leap ships no
# /etc/SuSE-release, so without this arm the sub returns undef -- which matches no
# case's os: restriction, so xcattest skips every os-restricted case and reports it as
# "has an invalid OS option", blaming the case.
return 'sles' if $text =~ /opensuse/i;
if ($text =~ /^ID\s*=\s*"?openeuler"?\s*$/mi) {
my ($version) = $text =~ /^VERSION\s*=\s*"?([^"\n]+?)"?\s*$/mi;
my $release = _openeuler_release($version);