1 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"> 5 6 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading"> 7 <tr bgcolor="#7799ee"> 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> 13 <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> 18 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> 31 32 <tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td> 33 <td width="100%"><dl> 34 <dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a> 35 </font></dt><dd> 36 <dl> 37 <dt><font face="helvetica, arial"><a href="telemetry.core.chrome.cros_interface.html#CrOSInterface">CrOSInterface</a> 38 </font></dt></dl> 39 </dd> 40 <dt><font face="helvetica, arial"><a href="exceptions.html#Exception">exceptions.Exception</a>(<a href="exceptions.html#BaseException">exceptions.BaseException</a>) 41 </font></dt><dd> 42 <dl> 43 <dt><font face="helvetica, arial"><a href="telemetry.core.chrome.cros_interface.html#LoginException">LoginException</a> 44 </font></dt><dd> 45 <dl> 46 <dt><font face="helvetica, arial"><a href="telemetry.core.chrome.cros_interface.html#KeylessLoginRequiredException">KeylessLoginRequiredException</a> 47 </font></dt></dl> 48 </dd> 49 </dl> 50 </dd> 51 </dl> 52 <p> 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> 57 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> 61 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> 63 64 <dl><dt><a name="CrOSInterface-FormSSHCommandLine"><strong>FormSSHCommandLine</strong></a>(self, args, extra_ssh_args<font color="#909090">=None</font>)</dt></dl> 65 66 <dl><dt><a name="CrOSInterface-GetFileContents"><strong>GetFileContents</strong></a>(self, filename)</dt></dl> 67 68 <dl><dt><a name="CrOSInterface-GetRemotePort"><strong>GetRemotePort</strong></a>(self)</dt></dl> 69 70 <dl><dt><a name="CrOSInterface-IsHTTPServerRunningOnPort"><strong>IsHTTPServerRunningOnPort</strong></a>(self, port)</dt></dl> 71 72 <dl><dt><a name="CrOSInterface-IsServiceRunning"><strong>IsServiceRunning</strong></a>(self, service_name)</dt></dl> 73 74 <dl><dt><a name="CrOSInterface-KillAllMatching"><strong>KillAllMatching</strong></a>(self, predicate)</dt></dl> 75 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> 77 78 <dl><dt><a name="CrOSInterface-PushContents"><strong>PushContents</strong></a>(self, text, remote_filename)</dt></dl> 79 80 <dl><dt><a name="CrOSInterface-PushFile"><strong>PushFile</strong></a>(self, filename, remote_filename)</dt></dl> 81 82 <dl><dt><a name="CrOSInterface-RmRF"><strong>RmRF</strong></a>(self, filename)</dt></dl> 83 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> 85 86 <dl><dt><a name="CrOSInterface-TryLogin"><strong>TryLogin</strong></a>(self)</dt></dl> 87 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> 89 90 <hr> 91 Data descriptors defined here:<br> 92 <dl><dt><strong>__dict__</strong></dt> 93 <dd><tt>dictionary for instance variables (if defined)</tt></dd> 94 </dl> 95 <dl><dt><strong>__weakref__</strong></dt> 96 <dd><tt>list of weak references to the object (if defined)</tt></dd> 97 </dl> 98 <dl><dt><strong>hostname</strong></dt> 99 </dl> 100 <dl><dt><strong>local</strong></dt> 101 </dl> 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> 107 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> 115 </dl> 116 <hr> 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> 120 </dl> 121 <hr> 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> 124 125 <hr> 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> 128 129 <hr> 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> 132 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> 134 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> 136 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> 138 <br> 139 Use of negative indices is not supported.</tt></dd></dl> 140 141 <dl><dt><a name="KeylessLoginRequiredException-__reduce__"><strong>__reduce__</strong></a>(...)</dt></dl> 142 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> 144 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> 146 147 <dl><dt><a name="KeylessLoginRequiredException-__setstate__"><strong>__setstate__</strong></a>(...)</dt></dl> 148 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> 150 151 <dl><dt><a name="KeylessLoginRequiredException-__unicode__"><strong>__unicode__</strong></a>(...)</dt></dl> 152 153 <hr> 154 Data descriptors inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> 155 <dl><dt><strong>__dict__</strong></dt> 156 </dl> 157 <dl><dt><strong>args</strong></dt> 158 </dl> 159 <dl><dt><strong>message</strong></dt> 160 </dl> 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> 166 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> 173 </dl> 174 <hr> 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> 178 </dl> 179 <hr> 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> 182 183 <hr> 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> 186 187 <hr> 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> 190 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> 192 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> 194 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> 196 <br> 197 Use of negative indices is not supported.</tt></dd></dl> 198 199 <dl><dt><a name="LoginException-__reduce__"><strong>__reduce__</strong></a>(...)</dt></dl> 200 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> 202 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> 204 205 <dl><dt><a name="LoginException-__setstate__"><strong>__setstate__</strong></a>(...)</dt></dl> 206 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> 208 209 <dl><dt><a name="LoginException-__unicode__"><strong>__unicode__</strong></a>(...)</dt></dl> 210 211 <hr> 212 Data descriptors inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> 213 <dl><dt><strong>__dict__</strong></dt> 214 </dl> 215 <dl><dt><strong>args</strong></dt> 216 </dl> 217 <dl><dt><strong>message</strong></dt> 218 </dl> 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> 224 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> 227 <br> 228 Args:<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> 233 <br> 234 Returns:<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> 240 <br> 241 Args:<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> 246 <br> 247 Returns:<br> 248 Return code from the command execution.</tt></dd></dl> 249 </td></tr></table> 250 </body></html>