]> xenbits.xensource.com Git - people/liuw/osstest.git/commitdiff
TestSupport: Add helper to fetch a URL on a host
authorIan Campbell <ian.campbell@citrix.com>
Wed, 8 Jul 2015 12:30:50 +0000 (13:30 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 23 Jul 2015 14:36:49 +0000 (15:36 +0100)
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Osstest/Debian.pm
Osstest/TestSupport.pm

index 718a7e2539a504b68d37fdb4b537e2f2986086b8..2d49ff8f6997dcbf16955734bf361d8642c88d5b 100644 (file)
@@ -841,7 +841,7 @@ d-i apt-setup/another boolean false
 d-i apt-setup/non-free boolean false
 d-i apt-setup/contrib boolean false
 
-d-i pkgsel/include string openssh-server, ntp, ntpdate, ethtool, chiark-utils-bin, $extra_packages
+d-i pkgsel/include string openssh-server, ntp, ntpdate, ethtool, chiark-utils-bin, wget, $extra_packages
 
 d-i grub-installer/force-efi-extra-removable boolean true
 
index 66dc2180a2e284cf920e3bc5d5440ed2fbee65d1..306330eccd0ec3e70a66d4a8dc4443d364417fd5 100644 (file)
@@ -55,7 +55,7 @@ BEGIN {
                       target_putfilecontents_stash
                      target_putfilecontents_root_stash
                       target_put_guest_image target_editfile
-                      target_editfile_cancel
+                      target_editfile_cancel target_fetchurl
                       target_editfile_root target_file_exists
                       target_editfile_kvp_replace
                       target_run_apt
@@ -1595,6 +1595,16 @@ END
     return $cfgpath;
 }
 
+sub target_fetchurl($$$;$) {
+    my ($ho, $url, $path, $timeo) = @_;
+    $timeo ||= 2000;
+    my $useproxy = "export http_proxy=$c{HttpProxy};" if $c{HttpProxy};
+    target_cmd_root($ho, <<END, $timeo);
+    $useproxy wget --progress=dot:mega -O \Q$path\E \Q$url\E
+END
+}
+
+
 sub target_put_guest_image ($$;$) {
     my ($ho, $gho, $default) = @_;
     my $specimage = $r{"$gho->{Guest}_image"};