diff mbox

[Xen-devel,OSSTEST,v2,04/15] TestSupport: Add helper to fetch a URL on a host

Message ID 1398681696-2773-4-git-send-email-ian.campbell@citrix.com
State New
Headers show

Commit Message

Ian Campbell April 28, 2014, 10:41 a.m. UTC
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 Osstest/TestSupport.pm | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Ian Jackson May 2, 2014, 11:25 a.m. UTC | #1
Ian Campbell writes ("[PATCH OSSTEST v2 04/15] TestSupport: Add helper to fetch a URL on a host"):
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>

Do we make sure that wget is installed, somehow ?  I think it needs to
be added to some of the lists of packages.

Ian.
Ian Campbell May 2, 2014, 12:16 p.m. UTC | #2
On Fri, 2014-05-02 at 12:25 +0100, Ian Jackson wrote:
> Ian Campbell writes ("[PATCH OSSTEST v2 04/15] TestSupport: Add helper to fetch a URL on a host"):
> > Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> 
> Do we make sure that wget is installed, somehow ?  I think it needs to
> be added to some of the lists of packages.

It is there in practice (perhaps due to being priority important?). But
it would certainly be fine to list it in the preseed, I'll do that.

Ian.
diff mbox

Patch

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 6558fc8..35838a7 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -54,6 +54,7 @@  BEGIN {
                       target_putfile target_putfile_root
                       target_putfilecontents_stash
 		      target_putfilecontents_root_stash
+                      target_fetchurl
                       target_put_guest_image
                       target_editfile_root target_file_exists
                       target_run_apt
@@ -1431,6 +1432,13 @@  END
     return $cfgpath;
 }
 
+sub target_fetchurl($$$;$) {
+    my ($ho, $url, $path, $timeo) = @_;
+    $timeo ||= 2000;
+    target_cmd_root($ho, "wget --progress=dot:mega -O $path $url", $timeo);
+}
+
+
 sub target_put_guest_image ($$$) {
     my ($ho, $gho, $default) = @_;
     my $specimage = $r{"$gho->{Guest}_image"};