]> xenbits.xensource.com Git - people/aperard/osstest.git/commitdiff
TestSupport: Move cfg_tftp_di_version from Debian.pm
authorIan Jackson <ian.jackson@eu.citrix.com>
Wed, 30 Mar 2016 10:33:01 +0000 (11:33 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Wed, 30 Mar 2016 13:55:48 +0000 (14:55 +0100)
Strictly speaking this is a Debian-specific function.  But it is
called by selecthost.  TestSupport does not `use Osstest::Debian'
right now.  As a result, currently, if $suite is not set or
TftpDiVersion_$suite is not set, the program will crash with
  Undefined subroutine &Osstest::TestSupport::cfg_tftp_di_version called at Osstest/TestSupport.pm line 865.

Fix this by moving cfg_tftp_di_version to TestSupport, where it is
needed.

It would be possible to make the boundary between Osstest::TestSupport
and Osstest::Debian firmer by having selecthost explicitly call a
selecthost_do_debian_things (perhaps optionally, or as specified by
the caller).

But would be quite a palaver.  It is much more convenient to fudge the
issue.  (Of course if we have similar requirements for other OS's we
can put them in TestSupport too, provided they're not too big and
tangly.)

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
v2: Change `use' in getconfig_TftpDiVersion_suite

Osstest/Debian.pm
Osstest/TestSupport.pm
cri-getconfig

index 1e4900b394f5cefdf90e3ee34f6cccecb1aaf943..5eecf920045d836cf4aced90e53f6450bc0fe492 100644 (file)
@@ -46,7 +46,6 @@ BEGIN {
                       preseed_hook_cmds
                       di_installcmdline_core
                       di_vg_name
-                      cfg_tftp_di_version
                       );
     %EXPORT_TAGS = ( );
 
@@ -1360,12 +1359,6 @@ sub preseed_hook_cmds () {
     return $preseed;
 }
 
-sub cfg_tftp_di_version ($) {
-    my ($suite) = @_;
-    $suite //= 'x def suite'; # will not find $c{...}
-    return $c{"TftpDiVersion_$suite"} // $c{TftpDiVersion};
-}
-
 sub debian_guest_suite ($) {
     my ($gho) = @_;
 
index 572d657e0016b9e09d38e259bccda02136009f7a..9e6479a6d34e9ab628827266dc68bbe2334b9ca2 100644 (file)
@@ -84,6 +84,7 @@ BEGIN {
                       git_massage_url
 
                       sshopts authorized_keys
+                      cfg_tftp_di_version
                       remote_perl_script_open remote_perl_script_done
                       host_reboot target_reboot target_reboot_hard            
                       target_choose_vg target_umount_lv target_await_down
@@ -2251,6 +2252,12 @@ sub authorized_keys () {
     return $authkeys;
 }
 
+sub cfg_tftp_di_version ($) {
+    my ($suite) = @_;
+    $suite //= 'x def suite'; # will not find $c{...}
+    return $c{"TftpDiVersion_$suite"} // $c{TftpDiVersion};
+}
+
 #---------- webspace for installer ----------
 
 sub await_webspace_fetch_byleaf ($$$$$) {
index 8b76f3238065f5180c2fb713e92e196970c18f81..b2c91ac705f75458c87dd10eb7d25902e3ba4cdf 100644 (file)
@@ -28,7 +28,7 @@ getconfig () {
 getconfig_TftpDiVersion_suite () {
        perl -e '
                use Osstest;
-               use Osstest::Debian;
+               use Osstest::TestSupport;
                readglobalconfig();
                print cfg_tftp_di_version($ARGV[0]) or die $!;
        ' "$1"