overlord: ghost: check for upgrade on registration
Make ghost check for update from overlord on registration. This make
sure the client will always have an up-to-date version of client running
on the device.
BUG=none
TEST=start ghost with outdated version, ghost should update itself on start.
Change-Id: Id57a0c646e81fc0b23a4f01ff98ebed8226c6d55
Reviewed-on: https://chromium-review.googlesource.com/300851
Commit-Ready: Wei-Ning Huang <wnhuang@chromium.org>
Tested-by: Wei-Ning Huang <wnhuang@chromium.org>
Reviewed-by: Hsu Wei-Cheng <mojahsu@chromium.org>
diff --git a/py/tools/ghost.py b/py/tools/ghost.py
index dc7a610..fea267b 100755
--- a/py/tools/ghost.py
+++ b/py/tools/ghost.py
@@ -903,11 +903,15 @@
if response is None:
self._reset.set()
raise RuntimeError('Register request timeout')
+
logging.info('Registered with Overlord at %s:%d', *non_local['addr'])
+ self._connected_addr = addr
+ self.Upgrade() # Check for upgrade
+ self._queue.put('pause', True)
+
if self._forward_ssh:
logging.info('Starting target SSH port negotiation')
self.NegotiateTargetSSHPort()
- self._queue.put('pause', True)
try:
logging.info('Trying %s:%d ...', *addr)
@@ -935,7 +939,6 @@
pass
else:
self._sock.settimeout(None)
- self._connected_addr = addr
self.Listen()
raise RuntimeError('Cannot connect to any server')