1#!/usr/bin/python
2
3import common, logging
4from autotest_lib.client.common_lib import global_config, utils
5from autotest_lib.scheduler import drone_utility
6
7class BaseResultsArchiver(object):
8    def archive_results(self, path):
9        results_host = global_config.global_config.get_config_value(
10                'SCHEDULER', 'results_host', default=None)
11        if not results_host or results_host == 'localhost':
12            return
13
14        if not path.endswith('/'):
15            path += '/'
16
17        logging.info('Archiving %s to %s', path, results_host)
18        utility = drone_utility.DroneUtility()
19        utility.sync_send_file_to(results_host, path, path, can_fail=True)
20
21
22ResultsArchiver = utils.import_site_class(
23        __file__, 'autotest_lib.scheduler.site_archive_results',
24        'SiteResultsArchiver', BaseResultsArchiver)
25