From 6e33661fc05788cb286c507a1fc0c98abb0e0c89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Wed, 22 Jul 2026 19:20:49 -0300 Subject: [PATCH 1/3] fix(nodech): handle comma-delimited values in the ,= operator nodech's ,= operator appended the whole right-hand side as one value, so "nodech n1 groups,=a,b" added the literal "a,b" and its duplicate check only compared against that combined string. Split the value on commas and add each piece individually, skipping any already present. Recovered from the unmerged lenovobuild branch (original 086b0c0d). Co-authored-by: Jarrod Johnson <10814490+jjohnson42@users.noreply.github.com> --- xCAT-server/lib/xcat/plugins/tabutils.pm | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/tabutils.pm b/xCAT-server/lib/xcat/plugins/tabutils.pm index 2cfa931c8..6254c0513 100644 --- a/xCAT-server/lib/xcat/plugins/tabutils.pm +++ b/xCAT-server/lib/xcat/plugins/tabutils.pm @@ -1742,11 +1742,14 @@ sub nodech if ($cent) { $curval = $cent->{$key}; } } if ($curval) { - my @vals = split(/,/, $curval); - unless (grep /^$val$/, @vals) { - unshift @vals, $val; - my $newval = join(',', @vals); - $uhsh{$key} = $newval; + foreach my $subval (split /,/, $val) { + my @vals = split(/,/, $curval); + unless (grep /^$subval$/, @vals) { + unshift @vals, $subval; + my $newval = join(',', @vals); + $uhsh{$key} = $newval; + $curval = $newval; + } } } else { $uhsh{$key} = $val; From f71ddef6ba050bf8413f27f5fdb4472ce4cf5c05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Wed, 22 Jul 2026 19:21:08 -0300 Subject: [PATCH 2/3] fix(nodech): support multiple groups in the ^= operator nodech's ^= operator removed only a single literal value, so "nodech n1 groups^=a,b" tried to strip the combined string "a,b" and left the individual groups in place. Split the value on commas and remove each piece. Recovered from the unmerged lenovobuild branch (original 95c78b33). Co-authored-by: Jarrod Johnson <10814490+jjohnson42@users.noreply.github.com> --- xCAT-server/lib/xcat/plugins/tabutils.pm | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/tabutils.pm b/xCAT-server/lib/xcat/plugins/tabutils.pm index 6254c0513..b77c6c464 100644 --- a/xCAT-server/lib/xcat/plugins/tabutils.pm +++ b/xCAT-server/lib/xcat/plugins/tabutils.pm @@ -1765,11 +1765,14 @@ sub nodech if ($cent) { $curval = $cent->{$key}; } } if ($curval) { - my @vals = split(/,/, $curval); - if (grep /^$val$/, @vals) { #only bother if there - @vals = grep(!/^$val$/, @vals); - my $newval = join(',', @vals); - $uhsh{$key} = $newval; + foreach my $subval (split /,/, $val) { + my @vals = split(/,/, $curval); + if (grep /^$subval$/, @vals) { #only bother if there + @vals = grep(!/^$subval$/, @vals); + my $newval = join(',', @vals); + $uhsh{$key} = $newval; + $curval = $newval; + } } } #else, what they asked for is the case alredy } From 25c9fb3836dd4ead25987cc70205943a6c9a5adb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Fri, 24 Jul 2026 13:07:17 -0300 Subject: [PATCH 3/3] test(nodech): cover comma-delimited group updates --- xCAT-test/autotest/testcase/nodech/cases0 | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/xCAT-test/autotest/testcase/nodech/cases0 b/xCAT-test/autotest/testcase/nodech/cases0 index 10db2ffa9..1583ded28 100644 --- a/xCAT-test/autotest/testcase/nodech/cases0 +++ b/xCAT-test/autotest/testcase/nodech/cases0 @@ -14,26 +14,27 @@ end start:nodech_noderange_table_comma -description:nodech testnode groups,=rhels5.5.Check nodech command with ,=. +description:Append multiple comma-delimited groups without duplicating an existing group. label:mn_only,ci_test,db -cmd:chdef -t node -o testnode groups=all +cmd:chdef -t node -o testnode groups=all,rhels5.5 check:rc==0 -cmd:nodech testnode groups,=rhels5.5 +cmd:nodech testnode groups,=rhels5.5,rhels5.6 check:rc==0 cmd:lsdef -t node -i groups testnode -check:output=~groups=rhels5.5,all +check:output=~groups=rhels5.6,all,rhels5.5 cmd:rmdef -t node testnode end start:nodech_noderange_table_arrow +description:Remove multiple comma-delimited groups while ignoring a group that is absent. label:mn_only,ci_test,db -cmd:chdef -t node -o testnode groups=all,rhels5.5 +cmd:chdef -t node -o testnode groups=all,rhels5.5,rhels5.6 check:rc==0 -cmd:nodech testnode groups^=rhels5.5 +cmd:nodech testnode groups^=rhels5.4,rhels5.5 check:rc==0 cmd:lsdef -t node -i groups testnode -check:output!=rhels5.5 +check:output=~groups=all,rhels5.6 cmd:rmdef -t node testnode end