2 <!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.0 Transitional//EN">
3 <html><head><title>Python: module telemetry.core.chrome.cros_interface
</title>
4 </head><body bgcolor=
"#f0f0f8">
6 <table width=
"100%" cellspacing=
0 cellpadding=
2 border=
0 summary=
"heading">
8 <td valign=bottom
> <br>
9 <font color=
"#ffffff" face=
"helvetica, arial"> <br><big><big><strong><a href=
"telemetry.html"><font color=
"#ffffff">telemetry
</font></a>.
<a href=
"telemetry.core.html"><font color=
"#ffffff">core
</font></a>.
<a href=
"telemetry.core.chrome.html"><font color=
"#ffffff">chrome
</font></a>.cros_interface
</strong></big></big></font></td
10 ><td align=right valign=bottom
11 ><font color=
"#ffffff" face=
"helvetica, arial"><a href=
".">index
</a><br><a href=
"../telemetry/core/chrome/cros_interface.py">telemetry/core/chrome/cros_interface.py
</a></font></td></tr></table>
12 <p><tt>A
wrapper
around
ssh
for
common
operations
on
a
CrOS-based
device
</tt></p>
14 <table width=
"100%" cellspacing=
0 cellpadding=
2 border=
0 summary=
"section">
15 <tr bgcolor=
"#aa55cc">
16 <td colspan=
3 valign=bottom
> <br>
17 <font color=
"#ffffff" face=
"helvetica, arial"><big><strong>Modules
</strong></big></font></td></tr>
19 <tr><td bgcolor=
"#aa55cc"><tt> </tt></td><td> </td>
20 <td width=
"100%"><table width=
"100%" summary=
"list"><tr><td width=
"25%" valign=top
><a href=
"logging.html">logging
</a><br>
21 <a href=
"os.html">os
</a><br>
22 </td><td width=
"25%" valign=top
><a href=
"re.html">re
</a><br>
23 <a href=
"subprocess.html">subprocess
</a><br>
24 </td><td width=
"25%" valign=top
><a href=
"sys.html">sys
</a><br>
25 <a href=
"tempfile.html">tempfile
</a><br>
26 </td><td width=
"25%" valign=top
></td></tr></table></td></tr></table><p>
27 <table width=
"100%" cellspacing=
0 cellpadding=
2 border=
0 summary=
"section">
28 <tr bgcolor=
"#ee77aa">
29 <td colspan=
3 valign=bottom
> <br>
30 <font color=
"#ffffff" face=
"helvetica, arial"><big><strong>Classes
</strong></big></font></td></tr>
32 <tr><td bgcolor=
"#ee77aa"><tt> </tt></td><td> </td>
34 <dt><font face=
"helvetica, arial"><a href=
"__builtin__.html#object">__builtin__.object
</a>
37 <dt><font face=
"helvetica, arial"><a href=
"telemetry.core.chrome.cros_interface.html#CrOSInterface">CrOSInterface
</a>
40 <dt><font face=
"helvetica, arial"><a href=
"exceptions.html#Exception">exceptions.Exception
</a>(
<a href=
"exceptions.html#BaseException">exceptions.BaseException
</a>)
43 <dt><font face=
"helvetica, arial"><a href=
"telemetry.core.chrome.cros_interface.html#LoginException">LoginException
</a>
46 <dt><font face=
"helvetica, arial"><a href=
"telemetry.core.chrome.cros_interface.html#KeylessLoginRequiredException">KeylessLoginRequiredException
</a>
53 <table width=
"100%" cellspacing=
0 cellpadding=
2 border=
0 summary=
"section">
54 <tr bgcolor=
"#ffc8d8">
55 <td colspan=
3 valign=bottom
> <br>
56 <font color=
"#000000" face=
"helvetica, arial"><a name=
"CrOSInterface">class
<strong>CrOSInterface
</strong></a>(
<a href=
"__builtin__.html#object">__builtin__.object
</a>)
</font></td></tr>
58 <tr><td bgcolor=
"#ffc8d8"><tt> </tt></td><td> </td>
59 <td width=
"100%">Methods defined here:
<br>
60 <dl><dt><a name=
"CrOSInterface-FileExistsOnDevice"><strong>FileExistsOnDevice
</strong></a>(self, file_name, quiet
<font color=
"#909090">=False
</font>)
</dt></dl>
62 <dl><dt><a name=
"CrOSInterface-FilesystemMountedAt"><strong>FilesystemMountedAt
</strong></a>(self, path)
</dt><dd><tt>Returns
the
filesystem
mounted
at
|path|
</tt></dd></dl>
64 <dl><dt><a name=
"CrOSInterface-FormSSHCommandLine"><strong>FormSSHCommandLine
</strong></a>(self, args, extra_ssh_args
<font color=
"#909090">=None
</font>)
</dt></dl>
66 <dl><dt><a name=
"CrOSInterface-GetFileContents"><strong>GetFileContents
</strong></a>(self, filename)
</dt></dl>
68 <dl><dt><a name=
"CrOSInterface-GetRemotePort"><strong>GetRemotePort
</strong></a>(self)
</dt></dl>
70 <dl><dt><a name=
"CrOSInterface-IsHTTPServerRunningOnPort"><strong>IsHTTPServerRunningOnPort
</strong></a>(self, port)
</dt></dl>
72 <dl><dt><a name=
"CrOSInterface-IsServiceRunning"><strong>IsServiceRunning
</strong></a>(self, service_name)
</dt></dl>
74 <dl><dt><a name=
"CrOSInterface-KillAllMatching"><strong>KillAllMatching
</strong></a>(self, predicate)
</dt></dl>
76 <dl><dt><a name=
"CrOSInterface-ListProcesses"><strong>ListProcesses
</strong></a>(self)
</dt><dd><tt>Returns
a
tuple
(pid,
cmd,
ppid)
of
all
processes
on
the
device.
</tt></dd></dl>
78 <dl><dt><a name=
"CrOSInterface-PushContents"><strong>PushContents
</strong></a>(self, text, remote_filename)
</dt></dl>
80 <dl><dt><a name=
"CrOSInterface-PushFile"><strong>PushFile
</strong></a>(self, filename, remote_filename)
</dt></dl>
82 <dl><dt><a name=
"CrOSInterface-RmRF"><strong>RmRF
</strong></a>(self, filename)
</dt></dl>
84 <dl><dt><a name=
"CrOSInterface-RunCmdOnDevice"><strong>RunCmdOnDevice
</strong></a>(self, args, cwd
<font color=
"#909090">=None
</font>, quiet
<font color=
"#909090">=False
</font>)
</dt></dl>
86 <dl><dt><a name=
"CrOSInterface-TryLogin"><strong>TryLogin
</strong></a>(self)
</dt></dl>
88 <dl><dt><a name=
"CrOSInterface-__init__"><strong>__init__
</strong></a>(self, hostname
<font color=
"#909090">=None
</font>, ssh_identity
<font color=
"#909090">=None
</font>)
</dt><dd><tt>#
pylint:
disable=R0923
</tt></dd></dl>
91 Data descriptors defined here:
<br>
92 <dl><dt><strong>__dict__
</strong></dt>
93 <dd><tt>dictionary
for
instance
variables
(if
defined)
</tt></dd>
95 <dl><dt><strong>__weakref__
</strong></dt>
96 <dd><tt>list
of
weak
references
to
the
object
(if
defined)
</tt></dd>
98 <dl><dt><strong>hostname
</strong></dt>
100 <dl><dt><strong>local
</strong></dt>
102 </td></tr></table> <p>
103 <table width=
"100%" cellspacing=
0 cellpadding=
2 border=
0 summary=
"section">
104 <tr bgcolor=
"#ffc8d8">
105 <td colspan=
3 valign=bottom
> <br>
106 <font color=
"#000000" face=
"helvetica, arial"><a name=
"KeylessLoginRequiredException">class
<strong>KeylessLoginRequiredException
</strong></a>(
<a href=
"telemetry.core.chrome.cros_interface.html#LoginException">LoginException
</a>)
</font></td></tr>
108 <tr><td bgcolor=
"#ffc8d8"><tt> </tt></td><td> </td>
109 <td width=
"100%"><dl><dt>Method resolution order:
</dt>
110 <dd><a href=
"telemetry.core.chrome.cros_interface.html#KeylessLoginRequiredException">KeylessLoginRequiredException
</a></dd>
111 <dd><a href=
"telemetry.core.chrome.cros_interface.html#LoginException">LoginException
</a></dd>
112 <dd><a href=
"exceptions.html#Exception">exceptions.Exception
</a></dd>
113 <dd><a href=
"exceptions.html#BaseException">exceptions.BaseException
</a></dd>
114 <dd><a href=
"__builtin__.html#object">__builtin__.object
</a></dd>
117 Data descriptors inherited from
<a href=
"telemetry.core.chrome.cros_interface.html#LoginException">LoginException
</a>:
<br>
118 <dl><dt><strong>__weakref__
</strong></dt>
119 <dd><tt>list
of
weak
references
to
the
object
(if
defined)
</tt></dd>
122 Methods inherited from
<a href=
"exceptions.html#Exception">exceptions.Exception
</a>:
<br>
123 <dl><dt><a name=
"KeylessLoginRequiredException-__init__"><strong>__init__
</strong></a>(...)
</dt><dd><tt>x.
<a href=
"#KeylessLoginRequiredException-__init__">__init__
</a>(...)
initializes
x;
see
help(type(x))
for
signature
</tt></dd></dl>
126 Data and other attributes inherited from
<a href=
"exceptions.html#Exception">exceptions.Exception
</a>:
<br>
127 <dl><dt><strong>__new__
</strong> =
<built-in method __new__ of type object
><dd><tt>T.
<a href=
"#KeylessLoginRequiredException-__new__">__new__
</a>(S,
...)
-
> a
new
<a href=
"__builtin__.html#object">object
</a> with
type
S,
a
subtype
of
T
</tt></dl>
130 Methods inherited from
<a href=
"exceptions.html#BaseException">exceptions.BaseException
</a>:
<br>
131 <dl><dt><a name=
"KeylessLoginRequiredException-__delattr__"><strong>__delattr__
</strong></a>(...)
</dt><dd><tt>x.
<a href=
"#KeylessLoginRequiredException-__delattr__">__delattr__
</a>('name')
<==
> del
x.name
</tt></dd></dl>
133 <dl><dt><a name=
"KeylessLoginRequiredException-__getattribute__"><strong>__getattribute__
</strong></a>(...)
</dt><dd><tt>x.
<a href=
"#KeylessLoginRequiredException-__getattribute__">__getattribute__
</a>('name')
<==
> x.name
</tt></dd></dl>
135 <dl><dt><a name=
"KeylessLoginRequiredException-__getitem__"><strong>__getitem__
</strong></a>(...)
</dt><dd><tt>x.
<a href=
"#KeylessLoginRequiredException-__getitem__">__getitem__
</a>(y)
<==
> x[y]
</tt></dd></dl>
137 <dl><dt><a name=
"KeylessLoginRequiredException-__getslice__"><strong>__getslice__
</strong></a>(...)
</dt><dd><tt>x.
<a href=
"#KeylessLoginRequiredException-__getslice__">__getslice__
</a>(i,
j)
<==
> x[i:j]
<br>
139 Use
of
negative
indices
is
not
supported.
</tt></dd></dl>
141 <dl><dt><a name=
"KeylessLoginRequiredException-__reduce__"><strong>__reduce__
</strong></a>(...)
</dt></dl>
143 <dl><dt><a name=
"KeylessLoginRequiredException-__repr__"><strong>__repr__
</strong></a>(...)
</dt><dd><tt>x.
<a href=
"#KeylessLoginRequiredException-__repr__">__repr__
</a>()
<==
> repr(x)
</tt></dd></dl>
145 <dl><dt><a name=
"KeylessLoginRequiredException-__setattr__"><strong>__setattr__
</strong></a>(...)
</dt><dd><tt>x.
<a href=
"#KeylessLoginRequiredException-__setattr__">__setattr__
</a>('name',
value)
<==
> x.name
=
value
</tt></dd></dl>
147 <dl><dt><a name=
"KeylessLoginRequiredException-__setstate__"><strong>__setstate__
</strong></a>(...)
</dt></dl>
149 <dl><dt><a name=
"KeylessLoginRequiredException-__str__"><strong>__str__
</strong></a>(...)
</dt><dd><tt>x.
<a href=
"#KeylessLoginRequiredException-__str__">__str__
</a>()
<==
> str(x)
</tt></dd></dl>
151 <dl><dt><a name=
"KeylessLoginRequiredException-__unicode__"><strong>__unicode__
</strong></a>(...)
</dt></dl>
154 Data descriptors inherited from
<a href=
"exceptions.html#BaseException">exceptions.BaseException
</a>:
<br>
155 <dl><dt><strong>__dict__
</strong></dt>
157 <dl><dt><strong>args
</strong></dt>
159 <dl><dt><strong>message
</strong></dt>
161 </td></tr></table> <p>
162 <table width=
"100%" cellspacing=
0 cellpadding=
2 border=
0 summary=
"section">
163 <tr bgcolor=
"#ffc8d8">
164 <td colspan=
3 valign=bottom
> <br>
165 <font color=
"#000000" face=
"helvetica, arial"><a name=
"LoginException">class
<strong>LoginException
</strong></a>(
<a href=
"exceptions.html#Exception">exceptions.Exception
</a>)
</font></td></tr>
167 <tr><td bgcolor=
"#ffc8d8"><tt> </tt></td><td> </td>
168 <td width=
"100%"><dl><dt>Method resolution order:
</dt>
169 <dd><a href=
"telemetry.core.chrome.cros_interface.html#LoginException">LoginException
</a></dd>
170 <dd><a href=
"exceptions.html#Exception">exceptions.Exception
</a></dd>
171 <dd><a href=
"exceptions.html#BaseException">exceptions.BaseException
</a></dd>
172 <dd><a href=
"__builtin__.html#object">__builtin__.object
</a></dd>
175 Data descriptors defined here:
<br>
176 <dl><dt><strong>__weakref__
</strong></dt>
177 <dd><tt>list
of
weak
references
to
the
object
(if
defined)
</tt></dd>
180 Methods inherited from
<a href=
"exceptions.html#Exception">exceptions.Exception
</a>:
<br>
181 <dl><dt><a name=
"LoginException-__init__"><strong>__init__
</strong></a>(...)
</dt><dd><tt>x.
<a href=
"#LoginException-__init__">__init__
</a>(...)
initializes
x;
see
help(type(x))
for
signature
</tt></dd></dl>
184 Data and other attributes inherited from
<a href=
"exceptions.html#Exception">exceptions.Exception
</a>:
<br>
185 <dl><dt><strong>__new__
</strong> =
<built-in method __new__ of type object
><dd><tt>T.
<a href=
"#LoginException-__new__">__new__
</a>(S,
...)
-
> a
new
<a href=
"__builtin__.html#object">object
</a> with
type
S,
a
subtype
of
T
</tt></dl>
188 Methods inherited from
<a href=
"exceptions.html#BaseException">exceptions.BaseException
</a>:
<br>
189 <dl><dt><a name=
"LoginException-__delattr__"><strong>__delattr__
</strong></a>(...)
</dt><dd><tt>x.
<a href=
"#LoginException-__delattr__">__delattr__
</a>('name')
<==
> del
x.name
</tt></dd></dl>
191 <dl><dt><a name=
"LoginException-__getattribute__"><strong>__getattribute__
</strong></a>(...)
</dt><dd><tt>x.
<a href=
"#LoginException-__getattribute__">__getattribute__
</a>('name')
<==
> x.name
</tt></dd></dl>
193 <dl><dt><a name=
"LoginException-__getitem__"><strong>__getitem__
</strong></a>(...)
</dt><dd><tt>x.
<a href=
"#LoginException-__getitem__">__getitem__
</a>(y)
<==
> x[y]
</tt></dd></dl>
195 <dl><dt><a name=
"LoginException-__getslice__"><strong>__getslice__
</strong></a>(...)
</dt><dd><tt>x.
<a href=
"#LoginException-__getslice__">__getslice__
</a>(i,
j)
<==
> x[i:j]
<br>
197 Use
of
negative
indices
is
not
supported.
</tt></dd></dl>
199 <dl><dt><a name=
"LoginException-__reduce__"><strong>__reduce__
</strong></a>(...)
</dt></dl>
201 <dl><dt><a name=
"LoginException-__repr__"><strong>__repr__
</strong></a>(...)
</dt><dd><tt>x.
<a href=
"#LoginException-__repr__">__repr__
</a>()
<==
> repr(x)
</tt></dd></dl>
203 <dl><dt><a name=
"LoginException-__setattr__"><strong>__setattr__
</strong></a>(...)
</dt><dd><tt>x.
<a href=
"#LoginException-__setattr__">__setattr__
</a>('name',
value)
<==
> x.name
=
value
</tt></dd></dl>
205 <dl><dt><a name=
"LoginException-__setstate__"><strong>__setstate__
</strong></a>(...)
</dt></dl>
207 <dl><dt><a name=
"LoginException-__str__"><strong>__str__
</strong></a>(...)
</dt><dd><tt>x.
<a href=
"#LoginException-__str__">__str__
</a>()
<==
> str(x)
</tt></dd></dl>
209 <dl><dt><a name=
"LoginException-__unicode__"><strong>__unicode__
</strong></a>(...)
</dt></dl>
212 Data descriptors inherited from
<a href=
"exceptions.html#BaseException">exceptions.BaseException
</a>:
<br>
213 <dl><dt><strong>__dict__
</strong></dt>
215 <dl><dt><strong>args
</strong></dt>
217 <dl><dt><strong>message
</strong></dt>
219 </td></tr></table></td></tr></table><p>
220 <table width=
"100%" cellspacing=
0 cellpadding=
2 border=
0 summary=
"section">
221 <tr bgcolor=
"#eeaa77">
222 <td colspan=
3 valign=bottom
> <br>
223 <font color=
"#ffffff" face=
"helvetica, arial"><big><strong>Functions
</strong></big></font></td></tr>
225 <tr><td bgcolor=
"#eeaa77"><tt> </tt></td><td> </td>
226 <td width=
"100%"><dl><dt><a name=
"-GetAllCmdOutput"><strong>GetAllCmdOutput
</strong></a>(args, cwd
<font color=
"#909090">=None
</font>, quiet
<font color=
"#909090">=False
</font>)
</dt><dd><tt>Open
a
subprocess
to
execute
a
program
and
returns
its
output.
<br>
229 args:
A
string
or
a
sequence
of
program
arguments.
The
program
to
execute
is
<br>
230 the
string
or
the
first
item
in
the
args
sequence.
<br>
231 cwd:
If
not
None,
the
subprocess's
current
directory
will
be
changed
to
<br>
232 |cwd|
before
it's
executed.
<br>
235 Captures
and
returns
the
command's
stdout.
<br>
236 Prints
the
command's
stderr
to
logger
(which
defaults
to
stdout).
</tt></dd></dl>
237 <dl><dt><a name=
"-HasSSH"><strong>HasSSH
</strong></a>()
</dt></dl>
238 <dl><dt><a name=
"-IsRunningOnCrosDevice"><strong>IsRunningOnCrosDevice
</strong></a>()
</dt><dd><tt>Returns
True
if
we're
on
a
ChromeOS
device.
</tt></dd></dl>
239 <dl><dt><a name=
"-RunCmd"><strong>RunCmd
</strong></a>(args, cwd
<font color=
"#909090">=None
</font>, quiet
<font color=
"#909090">=False
</font>)
</dt><dd><tt>Opens
a
subprocess
to
execute
a
program
and
returns
its
return
value.
<br>
242 args:
A
string
or
a
sequence
of
program
arguments.
The
program
to
execute
is
<br>
243 the
string
or
the
first
item
in
the
args
sequence.
<br>
244 cwd:
If
not
None,
the
subprocess's
current
directory
will
be
changed
to
<br>
245 |cwd|
before
it's
executed.
<br>
248 Return
code
from
the
command
execution.
</tt></dd></dl>