| 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 |
| 11 from autotest_lib.client.bin import factory | 11 from autotest_lib.client.bin import factory |
| 12 from autotest_lib.client.bin import test, utils | 12 from autotest_lib.client.bin import test, utils |
| 13 from autotest_lib.client.common_lib import error | 13 from autotest_lib.client.bin import factory_error as error |
| 14 | 14 |
| 15 class factory_UploadLogs(test.test): | 15 class factory_UploadLogs(test.test): |
| 16 version = 1 | 16 version = 1 |
| 17 | 17 |
| 18 DEFAULT_DESTINATION_PARAM = { | 18 DEFAULT_DESTINATION_PARAM = { |
| 19 'method': 'ftp', | 19 'method': 'ftp', |
| 20 'host': 'localhost', | 20 'host': 'localhost', |
| 21 'port': ftplib.FTP.port, | 21 'port': ftplib.FTP.port, |
| 22 'user': 'anonymous', | 22 'user': 'anonymous', |
| 23 'passwd': '', | 23 'passwd': '', |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(self.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 |