@@ -2370,7 +2370,8 @@ sub host_pxefile ($;$) {
my ($ho, $templatekey) = @_;
my %v = %r;
$templatekey //= 'PxeTemplates';
- my $templates = $ho->{Tftp}{$templatekey} || $ho->{Tftp}{PxeTemplates};
+ my $templates = $ho->{Tftp}{$templatekey};
+ return undef unless defined $templates;
if (defined $ho->{Ether}) {
my $eth = $v{'ether'} = $ho->{Ether};
$eth =~ y/A-Z/a-z/;
@@ -120,6 +120,7 @@ sub cmd_mkpxedir () {
my $ho= selecthost("host=$hn");
my $pxefile = host_pxefile($ho);
my $pxerealfile = host_pxefile($ho, 'PxeTemplatesReal');
+ $pxerealfile //= $pxefile;
my $dirname = dirname $pxefile;
my $cmd = <<END;
set -e
host_pxefile now returns undef if the specified $templatekey is not configured, rather than defaulting to the plain PxeTemplates. This is going to useful because we want host_pxefile not to hardcode the default: with netgrub, the settings are all different. If $templatekey is 'PxeTemplates' then this only has any effect if the PxeTempltes is not defined - ie, a broken case. There is one place where $templatekey is not 'PxeTemplates', in mg-hosts. The defaulting to the value of PxeTemplates now occurs there. So, overall, no functional change in non-broken cases. Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com> --- Osstest/TestSupport.pm | 3 ++- mg-hosts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)