mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-06-21 05:25:32 +00:00
Merge pull request #6729 from chenhanxiao/substitute_by_order
xcattest: proper replace vars in test cases
This commit is contained in:
@ -1867,9 +1867,11 @@ sub getvar
|
||||
{
|
||||
my $str = shift;
|
||||
my $config_ref = shift;
|
||||
my @vars = ($str =~ /\$\$(\w+)/g);
|
||||
my @reverse_sorted_vars = reverse sort @vars;
|
||||
|
||||
while ($str =~ /\$\$(\w+)/) {
|
||||
my $varname = $1;
|
||||
# let $$AA and $$A have the same chance to be replaced.
|
||||
for my $varname (@reverse_sorted_vars) {
|
||||
if (exists($$config_ref{var}{$varname})) {
|
||||
$str =~ s/\$\$$varname/$$config_ref{var}{$varname}/g;
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user