diff mbox

[RFC,OSSTEST,v1,01/12] Debian: Abolish $suite and $xopts{Suite} from preseed_* interfaces.

Message ID 1452263399-14094-1-git-send-email-ian.campbell@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ian Campbell Jan. 8, 2016, 2:29 p.m. UTC
Generating a preseed for a suite which does not match the ->{Suite} of
the underlying guest or host object does not seem useful, so remove
this option and use ->{Suite} instead.

For guests ->{Suite} is set by debian_guest_suite() (which is called
from preseed_guest_create(), although it is often also called prior to
that) and by selectguest()

For hosts $ho->{Suite} is initialised by selecthost if we are in the
context of a $job (and if we aren't we had best not be trying to
reinstall a host).

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 Osstest/Debian.pm     | 14 ++++++++------
 ts-debian-di-install  |  1 -
 ts-debian-hvm-install |  2 +-
 ts-host-install       |  1 -
 4 files changed, 9 insertions(+), 9 deletions(-)

Comments

Ian Jackson Jan. 8, 2016, 3:08 p.m. UTC | #1
Ian Campbell writes ("[PATCH RFC OSSTEST v1 01/12] Debian: Abolish $suite and $xopts{Suite} from preseed_* interfaces."):
> Generating a preseed for a suite which does not match the ->{Suite} of
> the underlying guest or host object does not seem useful, so remove
> this option and use ->{Suite} instead.

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
diff mbox

Patch

diff --git a/Osstest/Debian.pm b/Osstest/Debian.pm
index 76171c0..93b0ad4 100644
--- a/Osstest/Debian.pm
+++ b/Osstest/Debian.pm
@@ -794,8 +794,10 @@  sub debian_overlays ($) {
     $func->('overlay', 'overlay.tar');
 }
 
-sub preseed_base ($$$$;@) {
-    my ($ho,$suite,$sfx,$extra_packages,%xopts) = @_;
+sub preseed_base ($$$;@) {
+    my ($ho,$sfx,$extra_packages,%xopts) = @_;
+
+    my $suite = $ho->{Suite};
 
     $xopts{ExtraPreseed} ||= '';
 
@@ -927,7 +929,7 @@  END
 sub preseed_create_guest ($$$;@) {
     my ($ho, $arch, $sfx, %xopts) = @_;
 
-    my $suite= $xopts{Suite} || $c{DebianSuite};
+    my $suite= debian_guest_suite($ho);
 
     my $extra_packages = "";
     if ($xopts{PvMenuLst}) {
@@ -962,7 +964,7 @@  END
         }
     }
 
-    my $preseed_file= preseed_base($ho, $suite, $sfx, $extra_packages, %xopts);
+    my $preseed_file= preseed_base($ho, $sfx, $extra_packages, %xopts);
     $preseed_file.= (<<END);
 d-i     partman-auto/method             string regular
 d-i     partman-auto/choose_recipe \\
@@ -1004,7 +1006,7 @@  sub preseed_create ($$;@) {
     my ($ho, $sfx, %xopts) = @_;
 
     my $disk= $xopts{DiskDevice} || '/dev/sda';
-    my $suite= $xopts{Suite} || $c{DebianSuite};
+    my $suite= $ho->{Suite};
 
     my $d_i= $ho->{Tftp}{Path}.'/'.$ho->{Tftp}{DiBase}.'/'.$r{arch}.'/'.
 	$c{TftpDiVersion}.'-'.$ho->{Suite};
@@ -1192,7 +1194,7 @@  END
 
     my $extra_packages = join(",",@extra_packages);
 
-    my $preseed_file= preseed_base($ho,$suite,$sfx,$extra_packages,%xopts);
+    my $preseed_file= preseed_base($ho,$sfx,$extra_packages,%xopts);
 
     $preseed_file .= (<<END);
 d-i partman-auto/method string lvm
diff --git a/ts-debian-di-install b/ts-debian-di-install
index 96acd0e..9a513d3 100755
--- a/ts-debian-di-install
+++ b/ts-debian-di-install
@@ -204,7 +204,6 @@  END
 	my $pvmenulst = ($bl eq "pvgrub" || $arch =~ /arm/);
 
 	$ps_url = preseed_create_guest($gho, $arch, '',
-				       Suite=>$suite,
 				       PvMenuLst=>$pvmenulst);
 
 	$extra_disk = "";
diff --git a/ts-debian-hvm-install b/ts-debian-hvm-install
index 96190a1..7521d57 100755
--- a/ts-debian-hvm-install
+++ b/ts-debian-hvm-install
@@ -55,7 +55,7 @@  our $gsuite;
 
 sub preseed () {
 
-    my $preseed_file = preseed_base($gho,$gsuite,'','',());
+    my $preseed_file = preseed_base($gho,'','',());
 
     my $disk = guest_var($gho,'diskdevice','/dev/xvda');
 
diff --git a/ts-host-install b/ts-host-install
index cfa6044..eb740fa 100755
--- a/ts-host-install
+++ b/ts-host-install
@@ -59,7 +59,6 @@  sub install () {
 
     my ($ps_url,$ps_file)= preseed_create
         ($ho, '',
-         Suite => $ho->{Suite},
          DiskDevice => $ho->{DiskDevice},
          Properties => $ho->{Properties},
          ExtraPreseed => <<END );