[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [OSSTEST PATCH 15/35] pxe templates: Do defaulting outside host_pxefile



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@xxxxxxxxxxxxx>
---
 Osstest/TestSupport.pm | 3 ++-
 mg-hosts               | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 888f0ac..4c6a677 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -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/;
diff --git a/mg-hosts b/mg-hosts
index f785454..ed51952 100755
--- 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
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.