telemetry.core.chrome.cros_interface
index
telemetry/core/chrome/cros_interface.py

A wrapper around ssh for common operations on a CrOS-based device

 
Modules
       
logging
os
re
subprocess
sys
tempfile

 
Classes
       
__builtin__.object
CrOSInterface
exceptions.Exception(exceptions.BaseException)
LoginException
KeylessLoginRequiredException

 
class CrOSInterface(__builtin__.object)
     Methods defined here:
FileExistsOnDevice(self, file_name, quiet=False)
FilesystemMountedAt(self, path)
Returns the filesystem mounted at |path|
FormSSHCommandLine(self, args, extra_ssh_args=None)
GetFileContents(self, filename)
GetRemotePort(self)
IsHTTPServerRunningOnPort(self, port)
IsServiceRunning(self, service_name)
KillAllMatching(self, predicate)
ListProcesses(self)
Returns a tuple (pid, cmd, ppid) of all processes on the device.
PushContents(self, text, remote_filename)
PushFile(self, filename, remote_filename)
RmRF(self, filename)
RunCmdOnDevice(self, args, cwd=None, quiet=False)
TryLogin(self)
__init__(self, hostname=None, ssh_identity=None)
# pylint: disable=R0923

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)
hostname
local

 
class KeylessLoginRequiredException(LoginException)
    
Method resolution order:
KeylessLoginRequiredException
LoginException
exceptions.Exception
exceptions.BaseException
__builtin__.object

Data descriptors inherited from LoginException:
__weakref__
list of weak references to the object (if defined)

Methods inherited from exceptions.Exception:
__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature

Data and other attributes inherited from exceptions.Exception:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from exceptions.BaseException:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__setstate__(...)
__str__(...)
x.__str__() <==> str(x)
__unicode__(...)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message

 
class LoginException(exceptions.Exception)
    
Method resolution order:
LoginException
exceptions.Exception
exceptions.BaseException
__builtin__.object

Data descriptors defined here:
__weakref__
list of weak references to the object (if defined)

Methods inherited from exceptions.Exception:
__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature

Data and other attributes inherited from exceptions.Exception:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from exceptions.BaseException:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__setstate__(...)
__str__(...)
x.__str__() <==> str(x)
__unicode__(...)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message

 
Functions
       
GetAllCmdOutput(args, cwd=None, quiet=False)
Open a subprocess to execute a program and returns its output.
 
Args:
  args: A string or a sequence of program arguments. The program to execute is
    the string or the first item in the args sequence.
  cwd: If not None, the subprocess's current directory will be changed to
    |cwd| before it's executed.
 
Returns:
  Captures and returns the command's stdout.
  Prints the command's stderr to logger (which defaults to stdout).
HasSSH()
IsRunningOnCrosDevice()
Returns True if we're on a ChromeOS device.
RunCmd(args, cwd=None, quiet=False)
Opens a subprocess to execute a program and returns its return value.
 
Args:
  args: A string or a sequence of program arguments. The program to execute is
    the string or the first item in the args sequence.
  cwd: If not None, the subprocess's current directory will be changed to
    |cwd| before it's executed.
 
Returns:
  Return code from the command execution.