mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-08-03 16:06:59 +00:00
fix(template): fall back to $::XCATROOT when XCATROOT is not in %ENV
envvar() resolves a template variable purely from %ENV, so a template that references $XCATROOT expands to an empty string whenever XCATROOT is not present in the environment of the process doing the substitution. $::XCATROOT is set as a package global at module load and is reliably available, so use it for that one variable before falling back to %ENV. Recovered from the unmerged lenovobuild branch (originalda72c6b8). Co-authored-by: Jarrod Johnson <10814490+jjohnson42@users.noreply.github.com> (cherry picked from commit34866ebc23)
This commit is contained in:
committed by
github-actions[bot]
parent
36823339b3
commit
1fbc92ddf0
@@ -1617,6 +1617,10 @@ sub envvar
|
||||
$envvar =~ s/^\$//;
|
||||
}
|
||||
|
||||
# $XCATROOT is reliably set as a package global even when it is absent from
|
||||
# %ENV, so a template referencing it does not expand to undef.
|
||||
if ($envvar eq 'XCATROOT') { return $::XCATROOT; }
|
||||
|
||||
return ($ENV{$envvar});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user