[autotest] Make sure autotest is staged before package install

Fixing an issue where at times the package manager would
attempt to install autotest after devserver's cache had expired.
The install would fail silently and would blow up when the
packages.checksum was a devserver 404 page instead of the expected
checksum file format.

Simply use the cros_host.verify_job_repo_url function to verify
the devserver is reachable, and make the devserver stage the
autotest artifacts if needed.

BUG=chromium:878008, b:109894838
TEST=Run hardware_memoryqual on local moblab

Change-Id: I147a50b14c6f1b4cac8b98049c8977f16542d012
Reviewed-on: https://chromium-review.googlesource.com/1246470
Commit-Ready: Matt Mallett <mattmallett@chromium.org>
Tested-by: Matt Mallett <mattmallett@chromium.org>
Reviewed-by: Prathmesh Prabhu <pprabhu@chromium.org>
diff --git a/server/autotest.py b/server/autotest.py
index ba31b1c..85b75b0 100644
--- a/server/autotest.py
+++ b/server/autotest.py
@@ -273,6 +273,8 @@
         if not repos:
             raise error.PackageInstallError("No repos to install an "
                                             "autotest client from")
+        # Make sure devserver has the autotest package staged
+        host.verify_job_repo_url()
         pkgmgr = packages.PackageManager(autodir, hostname=host.hostname,
                                          repo_urls=repos,
                                          do_locking=False,
diff --git a/server/autotest_unittest.py b/server/autotest_unittest.py
index 37207f8..6cc62b6 100755
--- a/server/autotest_unittest.py
+++ b/server/autotest_unittest.py
@@ -32,6 +32,7 @@
         self.host.job.default_profile_only = False
         self.host.job.args = []
         self.host.job.record = lambda *args: None
+        self.host.verify_job_repo_url = lambda *args: None
 
         # stubs
         self.god.stub_function(utils, "get_server_dir")