Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: server/hosts/abstract_ssh.py

Issue 6124004: Revert "Merge remote branch 'cros/upstream' into autotest-rebase" (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git@master
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « server/control_segments/install ('k') | server/hosts/factory.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 delete_flag = "" 108 delete_flag = ""
109 if preserve_symlinks: 109 if preserve_symlinks:
110 symlink_flag = "" 110 symlink_flag = ""
111 else: 111 else:
112 symlink_flag = "-L" 112 symlink_flag = "-L"
113 command = "rsync %s %s --timeout=1800 --rsh='%s' -az %s %s" 113 command = "rsync %s %s --timeout=1800 --rsh='%s' -az %s %s"
114 return command % (symlink_flag, delete_flag, ssh_cmd, 114 return command % (symlink_flag, delete_flag, ssh_cmd,
115 " ".join(sources), dest) 115 " ".join(sources), dest)
116 116
117 117
118 def _make_ssh_cmd(self, cmd):
119 """
120 Create a base ssh command string for the host which can be used
121 to run commands directly on the machine
122 """
123 base_cmd = make_ssh_command(user=self.user, port=self.port,
124 opts=self.master_ssh_option,
125 hosts_file=self.known_hosts_fd)
126
127 return '%s %s "%s"' % (base_cmd, self.hostname, utils.sh_escape(cmd))
128
129 def _make_scp_cmd(self, sources, dest): 118 def _make_scp_cmd(self, sources, dest):
130 """ 119 """
131 Given a list of source paths and a destination path, produces the 120 Given a list of source paths and a destination path, produces the
132 appropriate scp command for encoding it. Remote paths must be 121 appropriate scp command for encoding it. Remote paths must be
133 pre-encoded. 122 pre-encoded.
134 """ 123 """
135 command = ("scp -rq %s -o StrictHostKeyChecking=no " 124 command = ("scp -rq %s -o StrictHostKeyChecking=no "
136 "-o UserKnownHostsFile=%s -P %d %s '%s'") 125 "-o UserKnownHostsFile=%s -P %d %s '%s'")
137 return command % (self.master_ssh_option, self.known_hosts_fd, 126 return command % (self.master_ssh_option, self.known_hosts_fd,
138 self.port, " ".join(sources), dest) 127 self.port, " ".join(sources), dest)
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 583
595 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,
596 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
597 reduce the spam in the logs. 586 reduce the spam in the logs.
598 """ 587 """
599 logging.info("Clearing known hosts for host '%s', file '%s'.", 588 logging.info("Clearing known hosts for host '%s', file '%s'.",
600 self.hostname, self.known_hosts_fd) 589 self.hostname, self.known_hosts_fd)
601 # 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.
602 fh = open(self.known_hosts_fd, "w") 591 fh = open(self.known_hosts_fd, "w")
603 fh.close() 592 fh.close()
OLDNEW
« no previous file with comments | « server/control_segments/install ('k') | server/hosts/factory.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698