From: Ian Jackson Date: Wed, 30 Mar 2016 10:33:01 +0000 (+0100) Subject: TestSupport: Move cfg_tftp_di_version from Debian.pm X-Git-Tag: openstack-v11~367 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=2aef1832d6b8879da45ffeca51fbe93935f73219;p=people%2Faperard%2Fosstest.git TestSupport: Move cfg_tftp_di_version from Debian.pm 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 --- v2: Change `use' in getconfig_TftpDiVersion_suite --- diff --git a/Osstest/Debian.pm b/Osstest/Debian.pm index 1e4900b3..5eecf920 100644 --- a/Osstest/Debian.pm +++ b/Osstest/Debian.pm @@ -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) = @_; diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm index 572d657e..9e6479a6 100644 --- a/Osstest/TestSupport.pm +++ b/Osstest/TestSupport.pm @@ -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 ($$$$$) { diff --git a/cri-getconfig b/cri-getconfig index 8b76f323..b2c91ac7 100644 --- a/cri-getconfig +++ b/cri-getconfig @@ -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"