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

Side by Side Diff: telemetry/telemetry/core/cros_interface.py

Issue 2162963002: [polymer] Merge of master into polymer10-migration (Closed) Base URL: git@github.com:catapult-project/catapult.git@polymer10-migration
Patch Set: Merge polymer10-migration int polymer10-merge Created 4 years, 5 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
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 """A wrapper around ssh for common operations on a CrOS-based device""" 4 """A wrapper around ssh for common operations on a CrOS-based device"""
5 import logging 5 import logging
6 import os 6 import os
7 import re 7 import re
8 import shutil 8 import shutil
9 import stat 9 import stat
10 import subprocess 10 import subprocess
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 Args: 299 Args:
300 filename: The name of the local source file. 300 filename: The name of the local source file.
301 destfile: The name of the file to copy to, and if it is not specified 301 destfile: The name of the file to copy to, and if it is not specified
302 then it is the basename of the source file. 302 then it is the basename of the source file.
303 303
304 """ 304 """
305 logging.debug("GetFile(%s, %s)" % (filename, destfile)) 305 logging.debug("GetFile(%s, %s)" % (filename, destfile))
306 if self.local: 306 if self.local:
307 if destfile is not None and destfile != filename: 307 if destfile is not None and destfile != filename:
308 shutil.copyfile(filename, destfile) 308 shutil.copyfile(filename, destfile)
309 return 309 return
310 else:
311 raise OSError('No such file or directory %s' % filename)
310 312
311 if destfile is None: 313 if destfile is None:
312 destfile = os.path.basename(filename) 314 destfile = os.path.basename(filename)
313 args = self._FormSCPFromRemote(filename, os.path.abspath(destfile)) 315 args = self._FormSCPFromRemote(filename, os.path.abspath(destfile))
314 316
315 stdout, stderr = GetAllCmdOutput(args, quiet=True) 317 stdout, stderr = GetAllCmdOutput(args, quiet=True)
316 stderr = self._RemoveSSHWarnings(stderr) 318 stderr = self._RemoveSSHWarnings(stderr)
317 if stderr != '': 319 if stderr != '':
318 raise OSError('No such file or directory %s' % stderr) 320 raise OSError('No such file or directory %s' % stderr)
319 321
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 else: 533 else:
532 self.RunCmdOnDevice(['start', 'ui']) 534 self.RunCmdOnDevice(['start', 'ui'])
533 535
534 def CloseConnection(self): 536 def CloseConnection(self):
535 if not self.local: 537 if not self.local:
536 with open(os.devnull, 'w') as devnull: 538 with open(os.devnull, 'w') as devnull:
537 subprocess.call( 539 subprocess.call(
538 self.FormSSHCommandLine(['-O', 'exit', self._hostname]), 540 self.FormSSHCommandLine(['-O', 'exit', self._hostname]),
539 stdout=devnull, 541 stdout=devnull,
540 stderr=devnull) 542 stderr=devnull)
OLDNEW
« no previous file with comments | « telemetry/telemetry/benchmark_unittest.py ('k') | telemetry/telemetry/core/cros_interface_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698