OLD | NEW |
1 import os, logging, ConfigParser | 1 import os, logging, ConfigParser |
2 from autotest_lib.client.common_lib import autotemp, base_packages, error | 2 from autotest_lib.client.common_lib import autotemp, base_packages, error |
3 from autotest_lib.client.common_lib import global_config | 3 from autotest_lib.client.common_lib import global_config |
4 from autotest_lib.client.bin import harness | 4 from autotest_lib.client.bin import harness |
5 | 5 |
6 | 6 |
7 class harness_autoserv(harness.harness): | 7 class harness_autoserv(harness.harness): |
8 """ | 8 """ |
9 The server harness for running from autoserv | 9 The server harness for running from autoserv |
10 | 10 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 self._send_and_wait('AUTOTEST_FETCH_PACKAGE', pkg_name, dest_path) | 92 self._send_and_wait('AUTOTEST_FETCH_PACKAGE', pkg_name, dest_path) |
93 | 93 |
94 | 94 |
95 class AutoservFetcher(base_packages.RepositoryFetcher): | 95 class AutoservFetcher(base_packages.RepositoryFetcher): |
96 def __init__(self, package_manager, job_harness): | 96 def __init__(self, package_manager, job_harness): |
97 self.url = "autoserv://" | 97 self.url = "autoserv://" |
98 self.job_harness = job_harness | 98 self.job_harness = job_harness |
99 | 99 |
100 | 100 |
101 def fetch_pkg_file(self, filename, dest_path): | 101 def fetch_pkg_file(self, filename, dest_path): |
| 102 if os.path.exists(dest_path): |
| 103 os.remove(dest_path) |
102 logging.info('Fetching %s from autoserv to %s', filename, dest_path) | 104 logging.info('Fetching %s from autoserv to %s', filename, dest_path) |
103 self.job_harness.fetch_package(filename, dest_path) | 105 self.job_harness.fetch_package(filename, dest_path) |
104 if os.path.exists(dest_path): | 106 if os.path.exists(dest_path): |
105 logging.debug('Successfully fetched %s from autoserv', filename) | 107 logging.debug('Successfully fetched %s from autoserv', filename) |
106 else: | 108 else: |
107 raise error.PackageFetchError('%s not fetched from autoserv' | 109 raise error.PackageFetchError('%s not fetched from autoserv' |
108 % filename) | 110 % filename) |
OLD | NEW |