]> xenbits.xensource.com Git - people/aperard/osstest.git/commitdiff
pxe templates: Do defaulting outside host_pxefile
authorIan Jackson <ian.jackson@eu.citrix.com>
Tue, 17 Jan 2017 17:31:15 +0000 (17:31 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Sun, 22 Jan 2017 23:44:34 +0000 (23:44 +0000)
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
mg-hosts

index 1108dbd3266ea0dca32b1b091faa7e1269f98846..48dd15de4e6874ab5c72f534ef02d3213bbcf46d 100644 (file)
@@ -2381,7 +2381,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/;
index f7854549c01b23e7d95714b175a16a5107bbc607..ed51952806c05a2ad50a4f02cece95c14358b296 100755 (executable)
--- a/mg-hosts
+++ b/mg-hosts
@@ -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