| 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 error, logging_manager | 2 from autotest_lib.client.common_lib import 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 | 5 |
| 6 | 6 |
| 7 def make_ssh_command(user="root", port=22, opts='', connect_timeout=30): | 7 def make_ssh_command(user="root", port=22, opts='', connect_timeout=30): |
| 8 base_command = ("/usr/bin/ssh -a -q -x %s -o BatchMode=yes " | 8 base_command = ("/usr/bin/ssh -a -q -x %s -o BatchMode=yes " |
| 9 "-o ConnectTimeout=%d -o ServerAliveInterval=300 " | 9 "-o ConnectTimeout=%d -o ServerAliveInterval=300 " |
| 10 "-l %s -p %d") | 10 "-l %s -p %d") |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 utils.run(scp) | 288 utils.run(scp) |
| 289 except error.CmdError, e: | 289 except error.CmdError, e: |
| 290 raise error.AutoservRunError(e.args[0], e.args[1]) | 290 raise error.AutoservRunError(e.args[0], e.args[1]) |
| 291 | 291 |
| 292 self.run('find "%s" -type d -print0 | xargs -0r chmod o+rx' % dest) | 292 self.run('find "%s" -type d -print0 | xargs -0r chmod o+rx' % dest) |
| 293 self.run('find "%s" -type f -print0 | xargs -0r chmod o+r' % dest) | 293 self.run('find "%s" -type f -print0 | xargs -0r chmod o+r' % dest) |
| 294 if self.target_file_owner: | 294 if self.target_file_owner: |
| 295 self.run('chown -R %s %s' % (self.target_file_owner, dest)) | 295 self.run('chown -R %s %s' % (self.target_file_owner, dest)) |
| 296 | 296 |
| 297 | 297 |
| 298 def ssh_ping(self, timeout=60): | 298 def ssh_ping(self, timeout=5): |
| 299 """ |
| 300 TODO(petkov): decreased default timeout from 60 to 5 seconds |
| 301 to ensure that wait_down works correctly on Chromium OS. Don't |
| 302 upstream this change assuming the right fix gets implemented. |
| 303 """ |
| 299 try: | 304 try: |
| 300 self.run("true", timeout=timeout, connect_timeout=timeout) | 305 self.run("true", timeout=timeout, connect_timeout=timeout) |
| 301 except error.AutoservSSHTimeout: | 306 except error.AutoservSSHTimeout: |
| 302 msg = "Host (ssh) verify timed out (timeout = %d)" % timeout | 307 msg = "Host (ssh) verify timed out (timeout = %d)" % timeout |
| 303 raise error.AutoservSSHTimeout(msg) | 308 raise error.AutoservSSHTimeout(msg) |
| 304 except error.AutoservSshPermissionDeniedError: | 309 except error.AutoservSshPermissionDeniedError: |
| 305 #let AutoservSshPermissionDeniedError be visible to the callers | 310 #let AutoservSshPermissionDeniedError be visible to the callers |
| 306 raise | 311 raise |
| 307 except error.AutoservRunError, e: | 312 except error.AutoservRunError, e: |
| 308 # convert the generic AutoservRunError into something more | 313 # convert the generic AutoservRunError into something more |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 autodir = autotest._get_autodir(self) | 423 autodir = autotest._get_autodir(self) |
| 419 if autodir: | 424 if autodir: |
| 420 self.check_diskspace(autodir, | 425 self.check_diskspace(autodir, |
| 421 self.AUTOTEST_GB_DISKSPACE_REQUIRED) | 426 self.AUTOTEST_GB_DISKSPACE_REQUIRED) |
| 422 except error.AutoservHostError: | 427 except error.AutoservHostError: |
| 423 raise # only want to raise if it's a space issue | 428 raise # only want to raise if it's a space issue |
| 424 except Exception: | 429 except Exception: |
| 425 # autotest dir may not exist, etc. ignore | 430 # autotest dir may not exist, etc. ignore |
| 426 logging.debug('autodir space check exception, this is probably ' | 431 logging.debug('autodir space check exception, this is probably ' |
| 427 'safe to ignore\n' + traceback.format_exc()) | 432 'safe to ignore\n' + traceback.format_exc()) |
| OLD | NEW |