From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: [PATCH OSSTEST v8 02/14] TestSupport: Add helper to fetch a URL on a host Date: Wed, 8 Jul 2015 13:30:50 +0100 Message-ID: <1436358662-12886-2-git-send-email-ian.campbell@citrix.com> References: <1436358648.23508.32.camel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1436358648.23508.32.camel@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: ian.jackson@eu.citrix.com Cc: Ian Campbell , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org Signed-off-by: Ian Campbell --- v8: Use \Q...\E to safely quote $url and $path v7: Quote $url and $path, switch to a heredoc to avoid resulting over long line v5: Support http_proxy via $c{HttpProxy} v3: Make sure wget is installed --- Osstest/Debian.pm | 2 +- Osstest/TestSupport.pm | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Osstest/Debian.pm b/Osstest/Debian.pm index 718a7e2..2d49ff8 100644 --- a/Osstest/Debian.pm +++ b/Osstest/Debian.pm @@ -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 diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm index b5994a4..1cace4f 100644 --- a/Osstest/TestSupport.pm +++ b/Osstest/TestSupport.pm @@ -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, <{Guest}_image"}; -- 2.1.4