2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-07-31 18:19:40 +00:00

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>
This commit is contained in:
Vinícius Ferrão
2026-07-22 19:21:08 -03:00
parent 6e33661fc0
commit f71ddef6ba
+8 -5
View File
@@ -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
}