Try to double check that files have been successfully downloaded by
wget in the package manager because there are cases when it fails and
reports exit code as 0 (ex. when it does not know of some arguments like
the new --connection-timeout).
Signed-off-by: Mihai Rusu <dizzy@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@3464 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/common_lib/packages.py b/client/common_lib/packages.py
index 7995a1f..b9c0d80 100644
--- a/client/common_lib/packages.py
+++ b/client/common_lib/packages.py
@@ -361,7 +361,16 @@
pkg_path = os.path.join(source_url, filename)
try:
- self._run_command(self._wget_cmd_pattern % (pkg_path, dest_path))
+ cmd = self._wget_cmd_pattern % (pkg_path, dest_path)
+ result = self._run_command(cmd)
+
+ file_exists = self._run_command('ls %s' % dest_path,
+ _run_command_dargs={'ignore_status': True}).exit_status == 0
+ if not file_exists:
+ # wget failed but it did not reflect that in the exit status
+ logging.error('wget failed: %s', result)
+ raise error.CmdError(cmd, result)
+
logging.debug("Successfully fetched %s from %s", filename,
source_url)
except error.CmdError: