OLD | NEW |
1 # Copyright (c) 2009-2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2009-2010 The Chromium OS Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 from buildutil import BuildObject | 5 from buildutil import BuildObject |
6 from xml.dom import minidom | 6 from xml.dom import minidom |
7 | 7 |
8 import cherrypy | 8 import cherrypy |
9 import os | 9 import os |
10 import shutil | 10 import shutil |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 return (stanza[kind + '_image'], | 423 return (stanza[kind + '_image'], |
424 stanza[kind + '_checksum'], | 424 stanza[kind + '_checksum'], |
425 stanza[kind + '_size']) | 425 stanza[kind + '_size']) |
426 return (None, None, None) | 426 return (None, None, None) |
427 | 427 |
428 def HandleFactoryRequest(self, board_id, channel): | 428 def HandleFactoryRequest(self, board_id, channel): |
429 (filename, checksum, size) = self.GetFactoryImage(board_id, channel) | 429 (filename, checksum, size) = self.GetFactoryImage(board_id, channel) |
430 if filename is None: | 430 if filename is None: |
431 _LogMessage('unable to find image for board %s' % board_id) | 431 _LogMessage('unable to find image for board %s' % board_id) |
432 return self.GetNoUpdatePayload() | 432 return self.GetNoUpdatePayload() |
433 url = 'http://%s/static/%s' % (self.hostname, filename) | 433 url = '%s/static/%s' % (self.hostname, filename) |
434 _LogMessage('returning update payload ' + url) | 434 _LogMessage('returning update payload ' + url) |
435 # Factory install is using memento updater which is using the sha-1 hash so | 435 # Factory install is using memento updater which is using the sha-1 hash so |
436 # setting sha-256 to an empty string. | 436 # setting sha-256 to an empty string. |
437 return self.GetUpdatePayload(checksum, '', size, url) | 437 return self.GetUpdatePayload(checksum, '', size, url) |
438 | 438 |
439 def HandleUpdatePing(self, data, label=None): | 439 def HandleUpdatePing(self, data, label=None): |
440 """Handles an update ping from an update client. | 440 """Handles an update ping from an update client. |
441 | 441 |
442 Args: | 442 Args: |
443 data: xml blob from client. | 443 data: xml blob from client. |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 size = self._GetSize(os.path.join(static_image_dir, 'update.gz')) | 517 size = self._GetSize(os.path.join(static_image_dir, 'update.gz')) |
518 if label: | 518 if label: |
519 url = '%s/%s/update.gz' % (static_urlbase, label) | 519 url = '%s/%s/update.gz' % (static_urlbase, label) |
520 else: | 520 else: |
521 url = '%s/update.gz' % static_urlbase | 521 url = '%s/update.gz' % static_urlbase |
522 | 522 |
523 _LogMessage('Responding to client to use url %s to get image.' % url) | 523 _LogMessage('Responding to client to use url %s to get image.' % url) |
524 return self.GetUpdatePayload(hash, sha256, size, url) | 524 return self.GetUpdatePayload(hash, sha256, size, url) |
525 else: | 525 else: |
526 return self.GetNoUpdatePayload() | 526 return self.GetNoUpdatePayload() |
OLD | NEW |