| OLD | NEW |
| 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 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 import ftplib | 5 import ftplib |
| 6 import gzip | 6 import gzip |
| 7 import hashlib | 7 import hashlib |
| 8 import os | 8 import os |
| 9 import StringIO | 9 import StringIO |
| 10 | 10 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 ftp.storbinary('STOR %s' % dest['filename'], fileobj) | 57 ftp.storbinary('STOR %s' % dest['filename'], fileobj) |
| 58 ftp.quit() | 58 ftp.quit() |
| 59 | 59 |
| 60 def run_once(self, destination): | 60 def run_once(self, destination): |
| 61 assert 'filename' not in destination, "file names must be generated" | 61 assert 'filename' not in destination, "file names must be generated" |
| 62 if destination['host'] == '*': | 62 if destination['host'] == '*': |
| 63 factory.log('WARNING: FACTORY LOG UPLOADING IS BYPASSED.') | 63 factory.log('WARNING: FACTORY LOG UPLOADING IS BYPASSED.') |
| 64 return | 64 return |
| 65 src_hash, src_obj = self.prepare_source_object(factory.LOG_PATH) | 65 src_hash, src_obj = self.prepare_source_object(factory.LOG_PATH) |
| 66 dest = {} | 66 dest = {} |
| 67 dest.update(DEFAULT_DESTINATION_PARAM) | 67 dest.update(self.DEFAULT_DESTINATION_PARAM) |
| 68 dest.update(destination) | 68 dest.update(destination) |
| 69 dest_name = src_hash + '.log' | 69 dest_name = src_hash + '.log' |
| 70 if self.USE_GZIP: | 70 if self.USE_GZIP: |
| 71 dest_name = dest_name + '.gz' | 71 dest_name = dest_name + '.gz' |
| 72 dest['filename'] = os.path.join(dest['initdir'], dest_name) | 72 dest['filename'] = os.path.join(dest['initdir'], dest_name) |
| 73 self.do_upload_file(dest, src_obj) | 73 self.do_upload_file(dest, src_obj) |
| OLD | NEW |