]> xenbits.xensource.com Git - osstest.git/commitdiff
subst_netboot_template: Do not use all of %r
authorIan Jackson <ian.jackson@eu.citrix.com>
Thu, 20 Aug 2020 16:49:31 +0000 (17:49 +0100)
committerIan Jackson <iwj@xenproject.org>
Wed, 7 Oct 2020 16:48:33 +0000 (17:48 +0100)
Instead of copying all of %r into %v, have the template substitutor
fall back to %r from %v.

This is going to be important when we have host-reuse-related access
control to %r.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Osstest/TestSupport.pm

index be6b7119b75ca1d85d3461dad77c0f9666f31859..634d6d2e3cfdbef1d98b9a262af56ecb99dcd668 100644 (file)
@@ -2876,6 +2876,7 @@ sub subst_netboot_template ($$$) {
        $pat =~ s{\%(\w*)\%}{
                    $1 eq '' ? '%' :
                    defined($v->{$1}) ? $v->{$1} :
+                   defined($r{$1}) ? $r{$1} :
                    next;
                 }ge;
        # and return the first pattern we managed to completely substitute
@@ -2890,7 +2891,7 @@ sub host_netboot_file ($;$) {
     # returns the full netboot filename path
     # in array context, returns (dir, pathtail)
     #  where dir does not depend on $templatekeytail
-    my %v = %r;
+    my %v;
     my $firmware = get_host_property($ho, "firmware");
     my $templatekeybase = $firmware eq 'uefi' ? 'NetGrub' : 'Pxe';
     $templatekeytail //= 'Templates';