OLD | NEW |
---|---|
1 import os, time, types, socket, shutil, glob, logging, traceback | 1 import os, time, types, socket, shutil, glob, logging, traceback |
2 from autotest_lib.client.common_lib import autotemp, error, logging_manager | 2 from autotest_lib.client.common_lib import autotemp, error, logging_manager |
3 from autotest_lib.server import utils, autotest | 3 from autotest_lib.server import utils, autotest |
4 from autotest_lib.server.hosts import remote | 4 from autotest_lib.server.hosts import remote |
5 from autotest_lib.client.common_lib.global_config import global_config | 5 from autotest_lib.client.common_lib.global_config import global_config |
6 | 6 |
7 | 7 |
8 get_value = global_config.get_config_value | 8 get_value = global_config.get_config_value |
9 enable_master_ssh = get_value('AUTOSERV', 'enable_master_ssh', type=bool, | 9 enable_master_ssh = get_value('AUTOSERV', 'enable_master_ssh', type=bool, |
10 default=False) | 10 default=False) |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 def use_rsync(self): | 62 def use_rsync(self): |
63 if self._use_rsync is not None: | 63 if self._use_rsync is not None: |
64 return self._use_rsync | 64 return self._use_rsync |
65 | 65 |
66 # Check if rsync is available on the remote host. If it's not, | 66 # Check if rsync is available on the remote host. If it's not, |
67 # don't try to use it for any future file transfers. | 67 # don't try to use it for any future file transfers. |
68 self._use_rsync = self._check_rsync() | 68 self._use_rsync = self._check_rsync() |
69 if not self._use_rsync: | 69 if not self._use_rsync: |
70 logging.warn("rsync not available on remote host %s -- disabled", | 70 logging.warn("rsync not available on remote host %s -- disabled", |
71 self.hostname) | 71 self.hostname) |
72 return self._use_rsync | |
truty
2010/11/15 19:32:09
This may be interesting to us.
| |
72 | 73 |
73 | 74 |
74 def _check_rsync(self): | 75 def _check_rsync(self): |
75 """ | 76 """ |
76 Check if rsync is available on the remote host. | 77 Check if rsync is available on the remote host. |
77 """ | 78 """ |
78 try: | 79 try: |
79 self.run("rsync --version", stdout_tee=None, stderr_tee=None) | 80 self.run("rsync --version", stdout_tee=None, stderr_tee=None) |
80 except error.AutoservRunError: | 81 except error.AutoservRunError: |
81 return False | 82 return False |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
582 | 583 |
583 This is useful if the test SSHes to the machine, then reinstalls it, | 584 This is useful if the test SSHes to the machine, then reinstalls it, |
584 then SSHes to it again. It can be called after the reinstall to | 585 then SSHes to it again. It can be called after the reinstall to |
585 reduce the spam in the logs. | 586 reduce the spam in the logs. |
586 """ | 587 """ |
587 logging.info("Clearing known hosts for host '%s', file '%s'.", | 588 logging.info("Clearing known hosts for host '%s', file '%s'.", |
588 self.hostname, self.known_hosts_fd) | 589 self.hostname, self.known_hosts_fd) |
589 # Clear out the file by opening it for writing and then closing. | 590 # Clear out the file by opening it for writing and then closing. |
590 fh = open(self.known_hosts_fd, "w") | 591 fh = open(self.known_hosts_fd, "w") |
591 fh.close() | 592 fh.close() |
OLD | NEW |