mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-08-04 00:16:59 +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 (original95c78b33). Co-authored-by: Jarrod Johnson <10814490+jjohnson42@users.noreply.github.com> (cherry picked from commitf71ddef6ba)
This commit is contained in:
committed by
github-actions[bot]
parent
24f95a98b2
commit
967560180c
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user