Autotest: delete http call to devserver for new ACL
Since new ACL forbiddens all ports except for port 22, this CL deletes the
direct http call to devserver in pre-check process of auto-update. It's
replaced by devserver healthy check, which uses inherited call to connect
to devserver. The inherited call in devserver use port 22 when the new ACL
applies.
BUG=chromium:618510
TEST=run local autotest instance and 'repair' job for dut to check the logic.
Change-Id: Ib30af06d34df68c0fca608b3263397ca49796b9f
Reviewed-on: https://chromium-review.googlesource.com/351681
Commit-Ready: Xixuan Wu <xixuan@chromium.org>
Tested-by: Xixuan Wu <xixuan@chromium.org>
Reviewed-by: Dan Shi <dshi@google.com>
diff --git a/client/common_lib/cros/autoupdater.py b/client/common_lib/cros/autoupdater.py
index 142f152..81a0d5f 100644
--- a/client/common_lib/cros/autoupdater.py
+++ b/client/common_lib/cros/autoupdater.py
@@ -3,7 +3,6 @@
# found in the LICENSE file.
import glob
-import httplib
import logging
import os
import re
@@ -471,11 +470,13 @@
# Check that Dev Server is accepting connections (from autoserv's host).
# If we can't talk to it, the machine host probably can't either.
- auserver_host = urlparse.urlparse(self.update_url)[1]
+ auserver_host = 'http://%s' % urlparse.urlparse(self.update_url)[1]
try:
- httplib.HTTPConnection(auserver_host).connect()
- except IOError as e:
- logging.debug('http IOError to devserver: %r', e)
+ if not dev_server.ImageServer.devserver_healthy(auserver_host):
+ raise ChromiumOSError(
+ 'Update server at %s not healthy' % auserver_host)
+ except Exception as e:
+ logging.debug('Error happens in connection to devserver: %r', e)
raise ChromiumOSError(
'Update server at %s not available' % auserver_host)